]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IpSecDxe/IpSecConfigImpl.c
Add pointer check for NULL before dereference it.
[mirror_edk2.git] / NetworkPkg / IpSecDxe / IpSecConfigImpl.c
index 87f85e7ca675d8b9ec33b8f0f48b853e8ef701a9..6eabfe45dee804f98511a7bb4985c5d9025945dc 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation of IPSEC_CONFIG_PROTOCOL.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2011, 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
@@ -2196,6 +2196,10 @@ IpSecGetVariable (
                         VariableNameISizeNew,\r
                         VariableNameI\r
                         );\r
+      if (VariableNameI == NULL) {\r
+        Status = EFI_OUT_OF_RESOURCES;\r
+        break;\r
+      }\r
       VariableNameISize = VariableNameISizeNew;\r
 \r
       Status = gRT->GetNextVariableName (\r
@@ -2272,7 +2276,9 @@ IpSecGetVariable (
   }\r
 \r
 ON_EXIT:\r
-  FreePool (VariableNameI);\r
+  if (VariableNameI != NULL) {\r
+    FreePool (VariableNameI);\r
+  }\r
   return Status;\r
 }\r
 \r
@@ -2700,7 +2706,7 @@ IpSecCopyPolicyEntry (
     Buffer->Capacity += EntrySize;\r
     TempPoint         = AllocatePool (Buffer->Capacity);\r
     \r
-    if (Buffer->Ptr == NULL) {\r
+    if (TempPoint == NULL) {\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
     //\r