diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-08-16 15:32:18 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-08-17 13:44:51 +0800 |
commit | 795c78cf190ba7ac3e7edd76e6c31b8505c2d739 (patch) | |
tree | 09e6026c702a7b345c0f2834fe6ddda07b3cfaf3 | |
parent | fd4d9c6495109979eb17779e07666c7c11c79c6a (diff) | |
download | edk2-platforms-795c78cf190ba7ac3e7edd76e6c31b8505c2d739.tar.xz |
ShellPkg/Ls: Handle the case when SearchString is NULL
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
-rw-r--r-- | ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c index 0b8019516f..9b4c452ca3 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)));
}
|