From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 99CF61A1E56 for ; Wed, 31 Aug 2016 18:34:50 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 31 Aug 2016 18:34:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,264,1470726000"; d="scan'208";a="163081330" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 31 Aug 2016 18:34:50 -0700 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 31 Aug 2016 18:34:50 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 31 Aug 2016 18:34:49 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.102]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.91]) with mapi id 14.03.0248.002; Thu, 1 Sep 2016 09:34:47 +0800 From: "Ni, Ruiyu" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" Thread-Topic: [patch] ShellPkg: Add the check of parameter number in "DrvCfg" command Thread-Index: AQHSA0htDPBJx8gFa0GC5QXFfoIgGKBj23XQ Date: Thu, 1 Sep 2016 01:34:46 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D58D4598D@SHSMSX103.ccr.corp.intel.com> References: <1472621209-205768-1-git-send-email-dandan.bi@intel.com> <1472621209-205768-2-git-send-email-dandan.bi@intel.com> In-Reply-To: <1472621209-205768-2-git-send-email-dandan.bi@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch] ShellPkg: Add the check of parameter number in "DrvCfg" 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: Thu, 01 Sep 2016 01:34:50 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni > -----Original Message----- > From: Bi, Dandan > Sent: Wednesday, August 31, 2016 1:27 PM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu ; Carsey, Jaben > Subject: [patch] ShellPkg: Add the check of parameter number in "DrvCfg" > command >=20 > In shell spec, the usage of "Drvcfg" command is: drvcfg [-l XXX] [-c] [-f > |-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. >=20 > Cc: Ruiyu Ni > Cc: Jaben Carsey > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Dandan Bi > --- > ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > 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 =3D=3D SHELL_SUCCESS) { > + if (ShellCommandLineGetCount(Package) > 4) { > + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), > gShellDriver1HiiHandle, L"drvcfg"); > + ShellStatus =3D SHELL_INVALID_PARAMETER; > + goto Done; > + } > Lang =3D ShellCommandLineGetValue(Package, L"-l"); > if (Lang !=3D NULL) { > Language =3D AllocateZeroPool(StrSize(Lang)); > AsciiSPrint(Language, StrSize(Lang), "%S", Lang); > } else if (ShellCommandLineGetFlag(Package, L"-l")){ > -- > 1.9.5.msysgit.1