]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Check for NULL pointer before dereference it.
authorFu Siyuan <siyuan.fu@intel.com>
Mon, 31 Oct 2016 02:21:24 +0000 (10:21 +0800)
committerFu Siyuan <siyuan.fu@intel.com>
Mon, 31 Oct 2016 08:03:00 +0000 (16:03 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c

index 4746256fa0fcf1676df321d8e9a2faec585b83da..639da4880f247073ce3391c2676e588f9f6d28cd 100644 (file)
@@ -2317,11 +2317,15 @@ EfiPxeBcSetStationIP (
   if (NewSubnetMask != NULL && !IP4_IS_VALID_NETMASK (NTOHL (NewSubnetMask->Addr[0]))) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
-  if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
 \r
+  if (NewStationIp != NULL) {\r
+    if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) || \r
+        IP4_IS_LOCAL_BROADCAST(NTOHL (NewStationIp->Addr[0])) ||\r
+        (NewSubnetMask != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0])))) {\r
+      return EFI_INVALID_PARAMETER;\r
+    }\r
+  }\r
+  \r
   Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This);\r
   Mode    = Private->PxeBc.Mode;\r
 \r