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>
This commit is contained in:
Dandan Bi
2016-08-25 09:37:05 +08:00
committed by Ruiyu Ni
parent 950a3bc788
commit d653d8062e
2 changed files with 6 additions and 1 deletions

View File

@ -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;