From d653d8062e48480a3ec689d688343306bb102b73 Mon Sep 17 00:00:00 2001 From: Dandan Bi Date: Thu, 25 Aug 2016 09:37:05 +0800 Subject: 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 Reviewed-by: Ruiyu Ni Reviewed-by: Jaben Carsey Reviewed-by: Tapan Shah --- ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c') 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; -- cgit v1.2.3