summaryrefslogtreecommitdiffstats
path: root/ShellPkg
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2017-06-22 15:22:33 +0800
committerStar Zeng <star.zeng@intel.com>2017-06-27 13:35:28 +0800
commit980af1eb0b7ad7a55fc51231a7fd537529319371 (patch)
tree9e64760103c5862742e1dea812c845d26904a053 /ShellPkg
parent45b57c1268f42bdad86287b5d41e8c1a86d98834 (diff)
downloadedk2-980af1eb0b7ad7a55fc51231a7fd537529319371.tar.gz
edk2-980af1eb0b7ad7a55fc51231a7fd537529319371.tar.bz2
edk2-980af1eb0b7ad7a55fc51231a7fd537529319371.zip
ShellPkg DmpStore: Make NameSize to be consistent with name buffer
Current code will allocate pool to hold the null char for name buffer when PrevName==NULL, but the NameSize is still 0. For this case, GetNextVariableName will return EFI_INVALID_PARAMETER to follow UEFI 2.7 spec. UEFI 2.7 spec: The VariableNameSize must not be smaller the size of the variable name string passed to GetNextVariableName() on input in the VariableName buffer. EFI_INVALID_PARAMETER Null-terminator is not found in the first VariableNameSize bytes of the input VariableName buffer. This patch is to make NameSize to be consistent with name buffer. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
index 23db54553f..aeffc89b19 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
@@ -436,6 +436,7 @@ CascadeProcessVariables (
StrnCatGrow(&FoundVarName, &NameSize, PrevName, 0);
} else {
FoundVarName = AllocateZeroPool(sizeof(CHAR16));
+ NameSize = sizeof(CHAR16);
}
Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);