diff options
author | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-01-02 18:07:13 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-01-02 18:07:13 +0000 |
commit | 1921657354d52f874679b9d117b37e6b36641abf (patch) | |
tree | 588d179670a030613ad08300dc26b5af74c5a9ae /ShellPkg/Application/Shell | |
parent | 9308b78a60dad1c0a48389ada80658173951ce06 (diff) | |
download | edk2-platforms-1921657354d52f874679b9d117b37e6b36641abf.tar.xz |
ShellPkg: fix Pipe usage verification.
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
Diffstat (limited to 'ShellPkg/Application/Shell')
-rw-r--r-- | ShellPkg/Application/Shell/Shell.c | 11 | ||||
-rw-r--r-- | ShellPkg/Application/Shell/Shell.uni | bin | 4416 -> 4618 bytes |
2 files changed, 8 insertions, 3 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index 05a3cb5b82..878a3852a5 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -1224,8 +1224,11 @@ RunSplitCommand( SHELL_FREE_NON_NULL(OurCommandLine);
SHELL_FREE_NON_NULL(NextCommandLine);
return (EFI_OUT_OF_RESOURCES);
- }
- if (NextCommandLine[0] != CHAR_NULL &&
+ } else if (StrStr(OurCommandLine, L"|") != NULL || Size1 == 0 || Size2 == 0) {
+ 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' '
){
@@ -1246,7 +1249,6 @@ RunSplitCommand( ASSERT(Split->SplitStdOut != NULL);
InsertHeadList(&ShellInfoObject.SplitList.Link, &Split->Link);
- ASSERT(StrStr(OurCommandLine, L"|") == NULL);
Status = RunCommand(OurCommandLine);
//
@@ -1432,6 +1434,9 @@ RunCommand( } else {
Status = RunSplitCommand(PostVariableCmdLine, Split->SplitStdIn, Split->SplitStdOut);
}
+ if (EFI_ERROR(Status)) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_INVALID_SPLIT), ShellInfoObject.HiiHandle, PostVariableCmdLine);
+ }
} else {
//
diff --git a/ShellPkg/Application/Shell/Shell.uni b/ShellPkg/Application/Shell/Shell.uni Binary files differindex 215da1cd76..c4eb546af7 100644 --- a/ShellPkg/Application/Shell/Shell.uni +++ b/ShellPkg/Application/Shell/Shell.uni |