]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Ip4Dxe: Fix the potential NULL pointer free
authorJiaxin Wu <jiaxin.wu@intel.com>
Thu, 29 Dec 2016 07:57:39 +0000 (15:57 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Wed, 4 Jan 2017 00:40:09 +0000 (08:40 +0800)
Ip4Config2SetDnsServer may cause ASSERT if the invalid DNS
server address received. The issue is triggered by the NULL
pointer(Tmp) free.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c

index 88ead9d26949cd2ec8d835680e8afff489621237..131b03f7711beda89be489fd2941bd4663853162 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation of EFI IPv4 Configuration II Protocol.\r
 \r
-  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
 \r
   This program and the accompanying materials\r
@@ -741,13 +741,17 @@ Ip4Config2SetDnsServerWorker (
       //\r
       // The dns server address must be unicast.\r
       //\r
-      FreePool (Tmp);\r
+      if (Tmp != NULL) {\r
+        FreePool (Tmp);\r
+      }\r
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r
     for (Index1 = NewIndex + 1; Index1 < NewDnsCount; Index1++) {\r
       if (EFI_IP4_EQUAL (NewDns + NewIndex, NewDns + Index1)) {\r
-        FreePool (Tmp);\r
+        if (Tmp != NULL) {\r
+          FreePool (Tmp);\r
+        }\r
         return EFI_INVALID_PARAMETER;\r
       }\r
     }\r