From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Ruiyu Ni <ruiyu.ni@intel.com>, Jaben Carsey <jaben.carsey@intel.com>
Subject: [patch] ShellPkg: Add the check of parameter number in "DrvCfg" command
Date: Wed, 31 Aug 2016 13:26:49 +0800 [thread overview]
Message-ID: <1472621209-205768-2-git-send-email-dandan.bi@intel.com> (raw)
In-Reply-To: <1472621209-205768-1-git-send-email-dandan.bi@intel.com>
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.
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c
index 0d12f01..cc1c9ca 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c
@@ -1210,10 +1210,15 @@ ShellCommandRunDrvCfg (
ASSERT(FALSE);
}
}
}
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));
AsciiSPrint(Language, StrSize(Lang), "%S", Lang);
} else if (ShellCommandLineGetFlag(Package, L"-l")){
--
1.9.5.msysgit.1
next prev parent reply other threads:[~2016-08-31 5:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-31 5:26 [patch] ShellPkg: Add check for "dump" parameter in "bcfg" command Dandan Bi
2016-08-31 5:26 ` Dandan Bi [this message]
2016-08-31 14:23 ` [patch] ShellPkg: Add the check of parameter number in "DrvCfg" command Shah, Tapan
2016-08-31 16:10 ` Carsey, Jaben
2016-09-01 1:34 ` Ni, Ruiyu
2016-08-31 14:23 ` [patch] ShellPkg: Add check for "dump" parameter in "bcfg" command Shah, Tapan
2016-08-31 16:11 ` Carsey, Jaben
2016-09-01 1:08 ` Bi, Dandan
2016-09-01 1:44 ` Carsey, Jaben
2016-09-01 1:58 ` Ni, Ruiyu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1472621209-205768-2-git-send-email-dandan.bi@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox