]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: fix Pipe usage verification.
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 2 Jan 2012 18:07:13 +0000 (18:07 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 2 Jan 2012 18:07:13 +0000 (18:07 +0000)
Add checks for nothing before or nothing after the pipe and output an error when pipe usage fails.

signed-off-by: jcarsey
reviewed-by: leegrosenbaum

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12903 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Application/Shell/Shell.c
ShellPkg/Application/Shell/Shell.uni

index 05a3cb5b82bdae30eef6205b84c8a3796131339e..878a3852a5e56c4cdd5c4b21186a6b585f19a3b3 100644 (file)
@@ -1224,8 +1224,11 @@ RunSplitCommand(
     SHELL_FREE_NON_NULL(OurCommandLine);\r
     SHELL_FREE_NON_NULL(NextCommandLine);\r
     return (EFI_OUT_OF_RESOURCES);\r
-  }\r
-  if (NextCommandLine[0] != CHAR_NULL &&\r
+  } else if (StrStr(OurCommandLine, L"|") != NULL || Size1 == 0 || Size2 == 0) {\r
+    SHELL_FREE_NON_NULL(OurCommandLine);\r
+    SHELL_FREE_NON_NULL(NextCommandLine);\r
+    return (EFI_INVALID_PARAMETER);\r
+  } else if (NextCommandLine[0] != CHAR_NULL &&\r
       NextCommandLine[0] == L'a' &&\r
       NextCommandLine[1] == L' '\r
      ){\r
@@ -1246,7 +1249,6 @@ RunSplitCommand(
   ASSERT(Split->SplitStdOut != NULL);\r
   InsertHeadList(&ShellInfoObject.SplitList.Link, &Split->Link);\r
 \r
-  ASSERT(StrStr(OurCommandLine, L"|") == NULL);\r
   Status = RunCommand(OurCommandLine);\r
 \r
   //\r
@@ -1432,6 +1434,9 @@ RunCommand(
     } else {\r
       Status = RunSplitCommand(PostVariableCmdLine, Split->SplitStdIn, Split->SplitStdOut);\r
     }\r
+    if (EFI_ERROR(Status)) {\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_SPLIT), ShellInfoObject.HiiHandle, PostVariableCmdLine);\r
+    }\r
   } else {\r
 \r
     //\r
index 215da1cd766e5da93126caf752402af91721cec8..c4eb546af740ed49404465d74d22598e91becd80 100644 (file)
Binary files a/ShellPkg/Application/Shell/Shell.uni and b/ShellPkg/Application/Shell/Shell.uni differ