Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <[email protected]>
Cc: Hao Wu <[email protected]>
---
ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
index 0b80195..9b4c452 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
@@ -709,6 +709,11 @@ ShellCommandRunLs (
// must split off the search part that applies to files from the
end of the directory part
//
StrnCatGrow(&SearchString, NULL, FullPath, 0);
+ if (SearchString == NULL) {
+ FreePool (FullPath);
+ ShellCommandLineFreeVarList (Package);
+ return SHELL_OUT_OF_RESOURCES;
+ }
PathRemoveLastItem (FullPath);
CopyMem (SearchString, SearchString + StrLen (FullPath), StrSize
(SearchString + StrLen (FullPath)));
}
--
2.9.0.windows.1
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel