summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c')
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
index 9cd5dd547a..b0cc6a3dc7 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
@@ -564,6 +564,11 @@ Ip4SetAddress (
NET_CHECK_SIGNATURE (Interface, IP4_INTERFACE_SIGNATURE);
+ Len = NetGetMaskLength (SubnetMask);
+ if (Len == IP4_MASK_NUM) {
+ return EFI_INVALID_PARAMETER;
+ }
+
//
// Set the ip/netmask, then compute the subnet broadcast
// and network broadcast for easy access. When computing
@@ -575,9 +580,6 @@ Ip4SetAddress (
Interface->Ip = IpAddr;
Interface->SubnetMask = SubnetMask;
Interface->SubnetBrdcast = (IpAddr | ~SubnetMask);
-
- Len = NetGetMaskLength (SubnetMask);
- ASSERT (Len <= IP4_MASK_MAX);
Interface->NetBrdcast = (IpAddr | ~SubnetMask);
//