From: "Carsey, Jaben" <jaben.carsey@intel.com>
To: "Bi, Dandan" <dandan.bi@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
"Carsey, Jaben" <jaben.carsey@intel.com>
Subject: Re: [patch] ShellPkg: Add check for "dump" parameter in "bcfg" command
Date: Wed, 31 Aug 2016 16:11:33 +0000 [thread overview]
Message-ID: <CB6E33457884FA40993F35157061515C54A33791@FMSMSX103.amr.corp.intel.com> (raw)
In-Reply-To: <1472621209-205768-1-git-send-email-dandan.bi@intel.com>
Should we check for too few also? What if the user sends 2 params?
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Dandan Bi
> Sent: Tuesday, August 30, 2016 10:27 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>
> Subject: [edk2] [patch] ShellPkg: Add check for "dump" parameter in "bcfg"
> command
> Importance: High
>
> 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.
>
> 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/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c |
> 4 ++++
> ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni |
> 3 ++-
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git
> a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
> b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
> index 9baeecc..e2306bf 100644
> ---
> a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
> +++
> b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
> @@ -1294,10 +1294,14 @@ ShellCommandRunBcfg (
> if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target <
> BcfgTargetMax) {
> for (ParamNumber = 2 ; ParamNumber <
> ShellCommandLineGetCount(Package) && ShellStatus == SHELL_SUCCESS;
> ParamNumber++) {
> 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;
> } else if (gUnicodeCollation->StriColl(gUnicodeCollation,
> (CHAR16*)CurrentParam, L"add") == 0) {
> if ((ParamNumber + 3) >= ShellCommandLineGetCount(Package)) {
> diff --git
> a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni
> b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni
> index 282494b..7668e49 100644
> ---
> a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni
> +++
> b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni
> @@ -1,9 +1,9 @@
> // /**
> //
> // (C) Copyright 2014-2015 Hewlett-Packard Development Company,
> L.P.<BR>
> -// Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
> +// Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
> // This program and the accompanying materials
> // are licensed and made available under the terms and conditions of the
> BSD License
> // which accompanies this distribution. The full text of the license may be
> found at
> // http://opensource.org/licenses/bsd-license.php
> //
> @@ -30,10 +30,11 @@
> #string STR_GEN_NO_VALUE #language en-US "%H%s%N: Missing
> argument for flag - '%H%s%N'\r\n"
> #string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid
> argument - '%H%s%N'\r\n"
> #string STR_GEN_NO_DRIVER_BOOT #language en-US "%H%s%N: Driver
> or Boot must be selected.\r\n"
> #string STR_GEN_BOOT_ONLY #language en-US "%H%s%N: Boot must
> be selected for hot key options.\r\n"
> #string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few
> arguments.\r\n"
> +#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many
> arguments\r\n"
> #string STR_GEN_FILE_OPEN_FAIL #language en-US "%H%s%N: Cannot
> open file - '%H%s%N'\r\n"
> #string STR_GEN_FIND_FAIL #language en-US "%H%s%N: File not found
> - '%H%s%N'\r\n"
> #string STR_GEN_OUT_MEM #language en-US "%H%s%N: Memory
> allocation was not successful.\r\n"
> #string STR_BCFG_WRITE_FAIL #language en-US "%H%s%N: Unable to
> write to '%H%s%N'\r\n"
> #string STR_BCFG_READ_FAIL #language en-US "%H%s%N: Unable to
> read from '%H%s%N'\r\n"
> --
> 1.9.5.msysgit.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
next prev parent reply other threads:[~2016-08-31 16:11 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
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 [this message]
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=CB6E33457884FA40993F35157061515C54A33791@FMSMSX103.amr.corp.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