]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
MdeModulePkg: Add error handling when IP address is Class E
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Impl.c
index aad667483a212d7b1056d39e47a4b7bf9e2daca9..9e496ef02711de18e2761ca80b36798d778b5513 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This file implement the EFI_DHCP4_PROTOCOL interface.\r
 \r
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1186,8 +1186,10 @@ EfiDhcp4Build (
   @param[in] UdpIo      The UdpIo being created.\r
   @param[in] Context    Dhcp4 instance.\r
 \r
-  @retval EFI_SUCCESS   UdpIo is configured successfully.\r
-  @retval other         Other error occurs.\r
+  @retval EFI_SUCCESS              UdpIo is configured successfully.\r
+  @retval EFI_INVALID_PARAMETER    Class E IP address is not supported or other parameters\r
+                                   are not valid.\r
+  @retval other                    Other error occurs.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -1229,7 +1231,14 @@ Dhcp4InstanceConfigUdpIo (
     // compute it according to the classful addressing rule.\r
     //\r
     Class = NetGetIpClass (ClientAddr);\r
+    //\r
+    //  Class E IP address is not supported here!\r
+    //\r
     ASSERT (Class < IP4_ADDR_CLASSE);\r
+    if (Class >= IP4_ADDR_CLASSE) {\r
+      return EFI_INVALID_PARAMETER;\r
+    }\r
+    \r
     SubnetMask = gIp4AllMasks[Class << 3];\r
   } else {\r
     SubnetMask = DhcpSb->Netmask;\r