]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel1CommandsLib/For.c
ShellPkg: Fix 'for' command fail with multiple fields.
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel1CommandsLib / For.c
index 2ecc5cd9ef4860fb3a2901de2a4013a1bc13201b..cbf05170135df46955a0fd42b96de5833441b545 100644 (file)
@@ -438,6 +438,11 @@ ShellCommandRunFor (
         gEfiShellParametersProtocol->Argv[2]) == 0) {\r
       for (LoopVar = 0x3 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) {\r
         ASSERT((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL));\r
+        if (StrStr (gEfiShellParametersProtocol->Argv[LoopVar], L")") != NULL &&\r
+            (LoopVar + 1) < gEfiShellParametersProtocol->Argc\r
+           ) {\r
+          return (SHELL_INVALID_PARAMETER);\r
+        }\r
         if (ArgSet == NULL) {\r
 //        ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);\r
         } else {\r