summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c')
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index a931bb3e77..5b01b35b76 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -1255,6 +1255,13 @@ Ip4Config2SetMaunualAddress (
NewAddress = *((EFI_IP4_CONFIG2_MANUAL_ADDRESS *) Data);
+ StationAddress = EFI_NTOHL (NewAddress.Address);
+ SubnetMask = EFI_NTOHL (NewAddress.SubnetMask);
+
+ if (NetGetMaskLength (SubnetMask) == IP4_MASK_NUM) {
+ return EFI_INVALID_PARAMETER;
+ }
+
//
// Store the new data, and init the DataItem status to EFI_NOT_READY because
// we may have an asynchronous configuration process.
@@ -1273,9 +1280,6 @@ Ip4Config2SetMaunualAddress (
DataItem->DataSize = DataSize;
DataItem->Status = EFI_NOT_READY;
- StationAddress = EFI_NTOHL (NewAddress.Address);
- SubnetMask = EFI_NTOHL (NewAddress.SubnetMask);
-
IpSb->Reconfig = TRUE;
Status = Ip4Config2SetDefaultAddr (IpSb, StationAddress, SubnetMask);
if (EFI_ERROR (Status)) {