]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg/Ip6Dxe: Fix the potential NULL pointer free
authorJiaxin Wu <jiaxin.wu@intel.com>
Tue, 3 Jan 2017 03:27:38 +0000 (11:27 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Wed, 4 Jan 2017 00:40:27 +0000 (08:40 +0800)
Ip6ConfigSetDnsServer 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>
NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c

index 9b6a62e9ec885b3894fc3d9a6211e15ed659134c..4e881fd6df20e3b65249ed141c67532a66bfea58 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation of EFI IPv6 Configuration Protocol.\r
 \r
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -1366,13 +1366,17 @@ Ip6ConfigSetDnsServer (
       //\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_IP6_EQUAL (NewDns + NewIndex, NewDns + Index1)) {\r
-        FreePool (Tmp);\r
+        if (Tmp != NULL) {\r
+          FreePool (Tmp);\r
+        }\r
         return EFI_INVALID_PARAMETER;\r
       }\r
     }\r