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
This commit is contained in:
jcarsey 2012-01-02 18:07:13 +00:00
parent 9308b78a60
commit 1921657354
2 changed files with 8 additions and 3 deletions

View File

@ -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 {
//

Binary file not shown.