summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel1CommandsLib
diff options
context:
space:
mode:
authorQiu Shumin <shumin.qiu@intel.com>2015-09-11 03:13:01 +0000
committerhwu1225 <hwu1225@Edk2>2015-09-11 03:13:01 +0000
commite5a9019a501bdde2fa22f5ca4d5ac651dd2d89cf (patch)
tree587ba795c57efde1c5a4e3fa0e42ae00a6e6667f /ShellPkg/Library/UefiShellLevel1CommandsLib
parenta687f448f938f0660356f3c07e393f93ef7166c4 (diff)
downloadedk2-platforms-e5a9019a501bdde2fa22f5ca4d5ac651dd2d89cf.tar.xz
ShellPkg: Fix 'for' command fail with multiple fields.
When multiple fields are found in 'for' command return invalid parameters error. (Sync patch r18416 from main trunk.) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@18442 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel1CommandsLib')
-rw-r--r--ShellPkg/Library/UefiShellLevel1CommandsLib/For.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c
index 2ecc5cd9ef..cbf0517013 100644
--- a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c
+++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c
@@ -438,6 +438,11 @@ ShellCommandRunFor (
gEfiShellParametersProtocol->Argv[2]) == 0) {
for (LoopVar = 0x3 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) {
ASSERT((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL));
+ if (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L")") != NULL &&
+ (LoopVar + 1) < gEfiShellParametersProtocol->Argc
+ ) {
+ return (SHELL_INVALID_PARAMETER);
+ }
if (ArgSet == NULL) {
// ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);
} else {