public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Shah, Tapan" <tapandshah@hpe.com>
To: Dandan Bi <dandan.bi@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>, Jaben Carsey <jaben.carsey@intel.com>
Subject: Re: [patch] ShellPkg: Add the check of parameter number in "DrvCfg" command
Date: Wed, 31 Aug 2016 14:23:50 +0000	[thread overview]
Message-ID: <CS1PR84MB022972E11CAC0F2EAEF14E9AD4E30@CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <1472621209-205768-2-git-send-email-dandan.bi@intel.com>

Reviewed-by: Tapan Shah <tapandshah@hpe.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Dandan Bi
Sent: Wednesday, August 31, 2016 12:27 AM
To: edk2-devel@lists.01.org
Cc: Ruiyu Ni <ruiyu.ni@intel.com>; Jaben Carsey <jaben.carsey@intel.com>
Subject: [edk2] [patch] 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.

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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2016-08-31 14:23 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 ` [patch] ShellPkg: Add the check of parameter number in "DrvCfg" command Dandan Bi
2016-08-31 14:23   ` Shah, Tapan [this message]
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=CS1PR84MB022972E11CAC0F2EAEF14E9AD4E30@CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.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