]> 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 d2896fe2f4671b8cdeba5517edaa918a08b8192c..cbf05170135df46955a0fd42b96de5833441b545 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for endfor and for shell level 1 functions.\r
 \r
-  Copyright (c) 2015, Hewlett-Packard Development Company, L.P.<BR>\r
+  (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
   Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -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