From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0730.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe49::730]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E35551A1E4B for ; Wed, 31 Aug 2016 07:23:52 -0700 (PDT) Received: from CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.151) by CS1PR84MB0230.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.152) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Wed, 31 Aug 2016 14:23:50 +0000 Received: from CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.COM ([10.162.190.151]) by CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.COM ([10.162.190.151]) with mapi id 15.01.0599.010; Wed, 31 Aug 2016 14:23:50 +0000 From: "Shah, Tapan" To: Dandan Bi , "edk2-devel@lists.01.org" CC: Ruiyu Ni , Jaben Carsey Thread-Topic: [edk2] [patch] ShellPkg: Add the check of parameter number in "DrvCfg" command Thread-Index: AQHSA0hk6JCgeBSSQU2N2HVS1/7OBaBjH/7Q Date: Wed, 31 Aug 2016 14:23:50 +0000 Message-ID: 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 X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=tapandshah@hpe.com; x-originating-ip: [15.203.227.10] x-ms-office365-filtering-correlation-id: 53ad5aba-c8d1-4161-916c-08d3d1aa6db0 x-microsoft-exchange-diagnostics: 1; CS1PR84MB0230; 6:5XYh4mzmQR9eshevq5ySP9MCj32OyzuAuVPC9t8ypel5pbTa4Gs/RUBj6c+lPAYPt8K4Dd95UcjYXe2nnT7cuoskxC8dSZ+IZnpBYWEkGiTa/HP5xfskg7ZB1YNMAJ2QKe0SLTVEWPzM54sBScc7vHxpqZD7ZSu5lgaKBnnjki4CdOBJIRRx17ohmumDhy/6TMmh+TYKZJqhrAfCU2MWpWWhmIFZwhvxdD2StR1HpY0U4iN5cF5gKRWrDDhuJGMgZ6EJg5qcLiCmo+tYdkKRyOzQkwLkJsJ56DBI/MWZEnCerpmh1y5TSXG6+jt6mVEDsSHf7DzoOhd3+0Hev5YrBw==; 5:DFxE2nkyY8cUoMYT3uJmGjPghDf8+FjwCUM4SKwEJpF/Lm0xoHwlR4mGOmp1bbmQXy01mc/pgvUGi88IeyZszgtSwabtq7j5T4+l3QqdNCeReaM83IX3+Zy24g65dT3Bayh1t0wzBsmrRdpcqi9EHQ==; 24:fCpFzrkdr3Jjw3QIs6PgVZ+h+0tcRDi+3lbCG420JZ3QkkC+j82fb5BlaghA8AzA0HyIjU5sA/J9wxq8LWwHAncOO0PVQC3OkVU5uv3/aeI=; 7:JgYibeJkRU4WBJ8N/X7SYnWLg2MARp98cIbwPiRANTQCbTks87g0MDBDq4VhuWal3OrdfeQhAa0jDtAPKDpmcDaY0qqw2vNazBobeHXWZnth8wUVBe0090v3q+ebpDyZ7Vt4nk6Fs3mDh/Pg2N/zAMP0l5omNyOv03Yp6TDyYsNm87ltmlliS54qNhom4RRMEvjPsCt4nZjpEanbru1O/N/h8AsbBnsEq5+3CkR7kANvcZmQZpQu7Dwkw9z1qzL0 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0230; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:CS1PR84MB0230; BCL:0; PCL:0; RULEID:; SRVR:CS1PR84MB0230; x-forefront-prvs: 00514A2FE6 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(199003)(189002)(377454003)(13464003)(5001770100001)(4326007)(92566002)(97736004)(68736007)(9686002)(87936001)(6116002)(102836003)(3846002)(8936002)(3280700002)(3660700001)(33656002)(5002640100001)(2906002)(76176999)(122556002)(2501003)(305945005)(10400500002)(7696003)(7846002)(15975445007)(2950100001)(8676002)(77096005)(189998001)(74316002)(2900100001)(54356999)(7736002)(101416001)(81156014)(81166006)(99286002)(105586002)(50986999)(5660300001)(66066001)(11100500001)(19580395003)(586003)(19580405001)(86362001)(106116001)(106356001)(21314002); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR84MB0230; H:CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Aug 2016 14:23:50.2353 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0230 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: Wed, 31 Aug 2016 14:23:53 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Tapan Shah -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Dand= an Bi Sent: Wednesday, August 31, 2016 12:27 AM To: edk2-devel@lists.01.org Cc: Ruiyu Ni ; Jaben Carsey Subject: [edk2] [patch] ShellPkg: Add the check of parameter number in "Drv= Cfg" 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 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(+) diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c b/ShellP= kg/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); } } }=20 if (ShellStatus =3D=3D SHELL_SUCCESS) { + if (ShellCommandLineGetCount(Package) > 4) { + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShel= lDriver1HiiHandle, 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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel