From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 626E81A1DF9 for ; Wed, 31 Aug 2016 09:11:47 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 31 Aug 2016 09:11:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,262,1470726000"; d="scan'208";a="3432642" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga004.jf.intel.com with ESMTP; 31 Aug 2016 09:11:38 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 31 Aug 2016 09:11:33 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.39]) by fmsmsx111.amr.corp.intel.com ([10.18.116.5]) with mapi id 14.03.0248.002; Wed, 31 Aug 2016 09:11:32 -0700 From: "Carsey, Jaben" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" , "Carsey, Jaben" Thread-Topic: [edk2] [patch] ShellPkg: Add check for "dump" parameter in "bcfg" command Thread-Index: AQHSA0ha4N7QDtKXxUOsxMVyN94SgqBjPgSw Date: Wed, 31 Aug 2016 16:11:33 +0000 Message-ID: References: <1472621209-205768-1-git-send-email-dandan.bi@intel.com> In-Reply-To: <1472621209-205768-1-git-send-email-dandan.bi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzA0OWE0ZTMtZjk0OC00YjhkLWFmZDUtNzkzNDVjZmFjNTdmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlNSTFNxR1RseStNb2hcL1A5dVFiVjVtek95Nit1bGNaNzBTdmhmSlpYeFNnPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: [patch] ShellPkg: Add check for "dump" parameter in "bcfg" command X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2016 16:11:47 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 ; Carsey, Jaben > Subject: [edk2] [patch] ShellPkg: Add check for "dump" parameter in "bcfg= " > command > Importance: High >=20 > 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. >=20 > Cc: Ruiyu Ni > Cc: Jaben Carsey > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Dandan Bi > --- > ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c | > 4 ++++ > ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni | > 3 ++- > 2 files changed, 6 insertions(+), 1 deletion(-) >=20 > 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 =3D=3D SHELL_SUCCESS && CurrentOperation.Target < > BcfgTargetMax) { > for (ParamNumber =3D 2 ; ParamNumber < > ShellCommandLineGetCount(Package) && ShellStatus =3D=3D SHELL_SUCCESS; > ParamNumber++) { > CurrentParam =3D ShellCommandLineGetRawValue(Package, > ParamNumber); > if (gUnicodeCollation->StriColl(gUnicodeCollation, > (CHAR16*)CurrentParam, L"dump") =3D=3D 0) { > CurrentOperation.Type =3D BcfgTypeDump; > + if (ShellCommandLineGetCount(Package) > 3) { > + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY= ), > gShellBcfgHiiHandle, L"bcfg"); > + ShellStatus =3D 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 =3D SHELL_INVALID_PARAMETER; > } else if (gUnicodeCollation->StriColl(gUnicodeCollation, > (CHAR16*)CurrentParam, L"add") =3D=3D 0) { > if ((ParamNumber + 3) >=3D 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.
> -// Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved. > +// Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved. > // 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 foun= d > - '%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 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel