]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
MdeModulePkg/Ip4Dxe: Add Ip/Netmask pair check for Ip4Config2
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Config2Impl.c
index 6c7ac68791c3c3e638731c1d723d6f047496d679..f4dfbb6e31a730f0529eaaab6c4327aaf8a3a3c1 100644 (file)
@@ -609,6 +609,13 @@ Ip4Config2SetDefaultIf (
 \r
   IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);\r
 \r
+  //\r
+  // Check whether the StationAddress/SubnetMask pair is valid.\r
+  //\r
+  if (!Ip4StationAddressValid (StationAddress, SubnetMask)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   Status = Ip4Config2SetDefaultAddr (IpSb, StationAddress, SubnetMask);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -1252,7 +1259,10 @@ Ip4Config2SetMaunualAddress (
   StationAddress = EFI_NTOHL (NewAddress.Address);\r
   SubnetMask = EFI_NTOHL (NewAddress.SubnetMask);\r
 \r
-  if (NetGetMaskLength (SubnetMask) == IP4_MASK_NUM) {\r
+  //\r
+  // Check whether the StationAddress/SubnetMask pair is valid.\r
+  //\r
+  if (!Ip4StationAddressValid (StationAddress, SubnetMask)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r