diff options
author | Dandan Bi <dandan.bi@intel.com> | 2016-08-25 09:37:05 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-09-01 16:38:06 +0800 |
commit | d653d8062e48480a3ec689d688343306bb102b73 (patch) | |
tree | b5c2d3af74934d4c3af5b1f6e4fc124d1796b3bc /ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c | |
parent | 950a3bc788b5b101729b26aed3ff75fd2a64a570 (diff) | |
download | edk2-d653d8062e48480a3ec689d688343306bb102b73.tar.gz edk2-d653d8062e48480a3ec689d688343306bb102b73.tar.bz2 edk2-d653d8062e48480a3ec689d688343306bb102b73.zip |
ShellPkg: Add check for "dump" parameter in "bcfg" command
When user uses the command "bcfg driver|boot [dump [-v]]",
the number of command line value parameters (doesn't include the
flag) must be three. We can add this point to check whether using
this 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/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c')
-rw-r--r-- | ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c index 9baeecc339..e2306bf469 100644 --- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c +++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c @@ -1296,6 +1296,10 @@ ShellCommandRunBcfg ( CurrentParam = ShellCommandLineGetRawValue(Package, ParamNumber);
if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"dump") == 0) {
CurrentOperation.Type = BcfgTypeDump;
+ if (ShellCommandLineGetCount(Package) > 3) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellBcfgHiiHandle, L"bcfg");
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ }
} else if (ShellCommandLineGetFlag(Package, L"-v")) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"-v (without dump)");
ShellStatus = SHELL_INVALID_PARAMETER;
|