Revision: 18462
http://sourceforge.net/p/edk2/code/18462
Author: hwu1225
Date: 2015-09-15 05:40:43 +0000 (Tue, 15 Sep 2015)
Log Message:
-----------
ShellPkg: Fix Shell does not support ASCII pipe(|a).
(Sync patch r18452 from main trunk.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Revision Links:
--------------
http://sourceforge.net/p/edk2/code/18452
Modified Paths:
--------------
branches/UDK2015/ShellPkg/Application/Shell/Shell.c
Modified: branches/UDK2015/ShellPkg/Application/Shell/Shell.c
===================================================================
--- branches/UDK2015/ShellPkg/Application/Shell/Shell.c 2015-09-15 05:40:12 UTC
(rev 18461)
+++ branches/UDK2015/ShellPkg/Application/Shell/Shell.c 2015-09-15 05:40:43 UTC
(rev 18462)
@@ -1578,11 +1578,18 @@
SHELL_FREE_NON_NULL(OurCommandLine);
SHELL_FREE_NON_NULL(NextCommandLine);
return (EFI_INVALID_PARAMETER);
- } else if (NextCommandLine[0] != CHAR_NULL &&
- NextCommandLine[0] == L'a' &&
- NextCommandLine[1] == L' '
- ){
+ } else if (NextCommandLine[0] == L'a' &&
+ (NextCommandLine[1] == L' ' || NextCommandLine[1] == CHAR_NULL)
+ ){
CopyMem(NextCommandLine, NextCommandLine+1, StrSize(NextCommandLine) -
sizeof(NextCommandLine[0]));
+ while (NextCommandLine[0] == L' ') {
+ CopyMem(NextCommandLine, NextCommandLine+1, StrSize(NextCommandLine) -
sizeof(NextCommandLine[0]));
+ }
+ if (NextCommandLine[0] == CHAR_NULL) {
+ SHELL_FREE_NON_NULL(OurCommandLine);
+ SHELL_FREE_NON_NULL(NextCommandLine);
+ return (EFI_INVALID_PARAMETER);
+ }
Unicode = FALSE;
} else {
Unicode = TRUE;
@@ -1884,6 +1891,13 @@
EFI_STATUS Status;
//
+ // If this was the only item, then get out
+ //
+ if (!ContainsSplit(CmdLine)) {
+ return (EFI_SUCCESS);
+ }
+
+ //
// Verify up to the pipe or end character
//
Status = IsValidSplit(CmdLine);
@@ -1892,16 +1906,16 @@
}
//
- // If this was the only item, then get out
- //
- if (!ContainsSplit(CmdLine)) {
- return (EFI_SUCCESS);
- }
-
- //
// recurse to verify the next item
//
TempSpot = FindFirstCharacter(CmdLine, L"|", L'^') + 1;
+ if (*TempSpot == L'a' &&
+ (*(TempSpot + 1) == L' ' || *(TempSpot + 1) == CHAR_NULL)
+ ) {
+ // If it's an ASCII pipe '|a'
+ TempSpot += 1;
+ }
+
return (VerifySplit(TempSpot));
}
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits