From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on070c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe49::70c]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A285C1A1E4B for ; Wed, 31 Aug 2016 07:23:29 -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:27 +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:27 +0000 From: "Shah, Tapan" To: Dandan Bi , "edk2-devel@lists.01.org" CC: Ruiyu Ni , Jaben Carsey Thread-Topic: [edk2] [patch] ShellPkg: Add check for "dump" parameter in "bcfg" command Thread-Index: AQHSA0hcdQ1bP4N1REmhSr+fK/sA1KBjH8eQ Date: Wed, 31 Aug 2016 14:23:26 +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: 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: 3ca6735b-db6b-4734-cfd9-08d3d1aa5fd3 x-microsoft-exchange-diagnostics: 1; CS1PR84MB0230; 6:Rj1FqJCnRsdpuf+X8KL4xvVfXwwTCd/jyg1y4fA9utzZG/YvLPLIF7YAgS2nU30Ij0e4RNUSv0/6Q6njWFAPCVhnY+UJLDftnj8bYhHz4cqZOY3JyEP5QV9OjwuwL5yucfzkC9vTIU1YFwREkKKen4cu4XCdgvMplTDlvBHXzfIyFadt82cNYT3etxE7nE4mii8U4G7KHeBNaanRevNwJUEWISv5W9+1OKQASctIks6a9W7Of+UVs8tqnS/GttL9QEA9BMjnZG6klTifJVFFI9Hjwq6zehfMMswr+Y1t6qybA/Agzsmfy1EFfzDHy9NGY0vEUEBzklj3okJM6lnSKA==; 5:5uu+9V43xnUS/0N3RKIUPHlXgglJlY0CGYbPkARaavhxoC68Wkp6atdFXv4ShcKUQ46t+nRc3g1R9EZVX9HPH0zDRXy8OVwVeH4fscQxKAagtklTscHg8qXlz/mMmuNnOs67/duFE4Tg3Dz31ap3SA==; 24:Vt8KFNAyXuzaR///oIIuQNz0jB5MFvBq5ZiBX7omaMns0sYm7XNlMVeNeep6sTBvDcpo5Bry9rX3XSws+lzWM37h/C6nCfhBgJ37Ydy7oEA=; 7:BOdMVN/WrczcTSHGUVGi3jWHmWE3varIMVp8jx+kDdDdmEhetAMEFl7uSIRLiU7BiIDBe1eIx1cvoudo1o0rJxy/aC/uYvdaSjvhEqPIJ7uJfCES8P6ap2Aw29RvP9NwAmFqMBkf6RG/WTihRgLJ9/XhU19mnwmaRsm6TVq1RsQA1bAA1FGJkj6zrjORLRMc304Yobe84lfrAjWxQLxWpAWDnGbbCPvlAiSZDB/Tra1SrhzsW4UJPUy1LTkk+us3 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)(15395725005)(76176999)(122556002)(2501003)(305945005)(10400500002)(7696003)(7846002)(15975445007)(2950100001)(8676002)(77096005)(189998001)(74316002)(2900100001)(54356999)(7736002)(101416001)(81156014)(81166006)(99286002)(105586002)(50986999)(5660300001)(66066001)(16799955002)(15188155005)(11100500001)(19580395003)(586003)(19580405001)(86362001)(106116001)(106356001); 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:26.9231 (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 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 14:23:29 -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 check for "dump" parameter in "bcfg" = command When user uses the command "bcfg driver|boot [dump [-v]]", the number of co= mmand line value parameters (doesn't include the flag) must be three. We can add this point to check whether using this comm= and correctly. 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(-) diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandL= ib.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 < Bcfg= TargetMax) { for (ParamNumber =3D 2 ; ParamNumber < ShellCommandLineGetCount(Pack= age) && 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)"); =20 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/UefiShellBcfgCommandL= ib.uni b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.u= ni index 282494b..7668e49 100644 --- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni +++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.u +++ ni @@ -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=20 +reserved.
// This program and the accompanying materials // are licensed and made a= vailable under the terms and conditions of the BSD License // which accomp= anies this distribution. The full text of the license may be found at // h= ttp://opensource.org/licenses/bsd-license.php // @@ -30,10 +30,11 @@ #string STR_GEN_NO_VALUE #language en-US "%H%s%N: Missing argumen= t for flag - '%H%s%N'\r\n" #string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid argumen= t - '%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 se= lected for hot key options.\r\n" #string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few argumen= ts.\r\n" +#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many argume= nts\r\n" #string STR_GEN_FILE_OPEN_FAIL #language en-US "%H%s%N: Cannot open fil= e - '%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 allocati= on 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