diff options
author | Qiu Shumin <shumin.qiu@intel.com> | 2015-09-09 04:57:05 +0000 |
---|---|---|
committer | shenshushi <shenshushi@Edk2> | 2015-09-09 04:57:05 +0000 |
commit | 8337590c42df0b0f89487077326a62768e7434ab (patch) | |
tree | e4f2f9e11bccdd6a8a567946526ccfbf0e9c6c78 /ShellPkg | |
parent | 50e7d3d90d90ac261ef32e832968cd44df830542 (diff) | |
download | edk2-platforms-8337590c42df0b0f89487077326a62768e7434ab.tar.xz |
ShellPkg: Fix 'for' command fail with multiple fields.
When multiple fields are found in 'for' command return invalid parameters error.
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/trunk/edk2@18416 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Library/UefiShellLevel1CommandsLib/For.c | 5 |
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 {
|