summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellDebug1CommandsLib
diff options
context:
space:
mode:
authorShumin Qiu <shumin.qiu@intel.com>2014-01-09 00:30:27 +0000
committershenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524>2014-01-09 00:30:27 +0000
commit03bc7c2b09c6f36930a5138c7727c0c4048539a7 (patch)
tree716a5992955a016ebbe836b7f0d5473af31be91d /ShellPkg/Library/UefiShellDebug1CommandsLib
parent0b716fd7649f13ca6c214aa47f39ab00212c7d6e (diff)
Add code to check whether the pointer 'NewBuffer' in 'FileHandelWrappers.c' and the pointer 'FoundVarName' in 'Dmpstore.c' are NULL before used.
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15060 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
index afeedb0959..b02048302e 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
@@ -121,11 +121,15 @@ CascadeProcessVariables (
if (Status == EFI_BUFFER_TOO_SMALL) {
SHELL_FREE_NON_NULL(FoundVarName);
FoundVarName = AllocateZeroPool (NameSize);
- if (PrevName != NULL) {
- StrCpy(FoundVarName, PrevName);
- }
+ if (FoundVarName != NULL) {
+ if (PrevName != NULL) {
+ StrCpy(FoundVarName, PrevName);
+ }
- Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);
+ Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);
+ } else {
+ Status = EFI_OUT_OF_RESOURCES;
+ }
}
//