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>
/** @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
//\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