summaryrefslogtreecommitdiff
path: root/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
diff options
context:
space:
mode:
authorsfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-08 02:55:30 +0000
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-08 02:55:30 +0000
commit02a758cb0b5bc8775d95e0a52acc483f850124a1 (patch)
tree97021cedc2e4bf82766ce9a5f74c4beaf345833d /NetworkPkg/IpSecDxe/IpSecConfigImpl.c
parent4bc6ad3935d7b57e5eacda5e6e70b32d786d43dd (diff)
downloadedk2-platforms-02a758cb0b5bc8775d95e0a52acc483f850124a1.tar.xz
Add pointer check for NULL before dereference it.
Signed-off-by: sfu5 Reviewed-by: xdu2 Reviewed-by: ydong10 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12514 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'NetworkPkg/IpSecDxe/IpSecConfigImpl.c')
-rw-r--r--NetworkPkg/IpSecDxe/IpSecConfigImpl.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/NetworkPkg/IpSecDxe/IpSecConfigImpl.c b/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
index 87f85e7ca6..6eabfe45de 100644
--- a/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
+++ b/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
@@ -1,7 +1,7 @@
/** @file
The implementation of IPSEC_CONFIG_PROTOCOL.
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -2196,6 +2196,10 @@ IpSecGetVariable (
VariableNameISizeNew,
VariableNameI
);
+ if (VariableNameI == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ break;
+ }
VariableNameISize = VariableNameISizeNew;
Status = gRT->GetNextVariableName (
@@ -2272,7 +2276,9 @@ IpSecGetVariable (
}
ON_EXIT:
- FreePool (VariableNameI);
+ if (VariableNameI != NULL) {
+ FreePool (VariableNameI);
+ }
return Status;
}
@@ -2700,7 +2706,7 @@ IpSecCopyPolicyEntry (
Buffer->Capacity += EntrySize;
TempPoint = AllocatePool (Buffer->Capacity);
- if (Buffer->Ptr == NULL) {
+ if (TempPoint == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//