summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2016-08-31 13:09:26 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2016-09-01 16:38:06 +0800
commitc6fc823413861c6bcafbb21bae9aab66b8ee5a24 (patch)
treee898a30698c8e698129139e1e4f9f3b6a3a0c320 /ShellPkg
parentd653d8062e48480a3ec689d688343306bb102b73 (diff)
downloadedk2-platforms-c6fc823413861c6bcafbb21bae9aab66b8ee5a24.tar.xz
ShellPkg: Add the check of parameter number in "DrvCfg" command
In shell spec, the usage of "Drvcfg" command is: drvcfg [-l XXX] [-c] [-f <Type>|-v|-s] [DriverHandle [DeviceHandle [ChildHandle]]] [-i filename] [-o filename]. The parameter number(doesn't include the flags) cannot exceed 4, now we add this point to check whether using the command correctly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Tapan Shah <tapandshah@hpe.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c
index 0d12f01199..cc1c9ca188 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c
@@ -1212,6 +1212,11 @@ ShellCommandRunDrvCfg (
}
}
if (ShellStatus == SHELL_SUCCESS) {
+ if (ShellCommandLineGetCount(Package) > 4) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drvcfg");
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ goto Done;
+ }
Lang = ShellCommandLineGetValue(Package, L"-l");
if (Lang != NULL) {
Language = AllocateZeroPool(StrSize(Lang));