summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 {