From 1921657354d52f874679b9d117b37e6b36641abf Mon Sep 17 00:00:00 2001 From: jcarsey Date: Mon, 2 Jan 2012 18:07:13 +0000 Subject: 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 --- ShellPkg/Application/Shell/Shell.c | 11 ++++++++--- 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 index 215da1cd76..c4eb546af7 100644 Binary files a/ShellPkg/Application/Shell/Shell.uni and b/ShellPkg/Application/Shell/Shell.uni differ -- cgit v1.2.3