]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg/Ls: Handle the case when SearchString is NULL
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 16 Aug 2016 07:32:18 +0000 (15:32 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 17 Aug 2016 05:44:51 +0000 (13:44 +0800)
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>
ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c

index 0b8019516f83a53abf44e00d1f483735274fea14..9b4c452ca3540b1d4f79adc4856630d09ffb15d1 100644 (file)
@@ -709,6 +709,11 @@ ShellCommandRunLs (
               // must split off the search part that applies to files from the end of the directory part\r
               //\r
               StrnCatGrow(&SearchString, NULL, FullPath, 0);\r
+              if (SearchString == NULL) {\r
+                FreePool (FullPath);\r
+                ShellCommandLineFreeVarList (Package);\r
+                return SHELL_OUT_OF_RESOURCES;\r
+              }\r
               PathRemoveLastItem (FullPath);\r
               CopyMem (SearchString, SearchString + StrLen (FullPath), StrSize (SearchString + StrLen (FullPath)));\r
             }\r