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 <[email protected]> Cc: Jaben Carsey <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <[email protected]> --- ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c index 23db54553f11..aeffc89b1991 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); -- 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

