From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@jwatt.org header.s=jwatt.org header.b=UbFylA1+; spf=softfail (domain: jwatt.org, ip: 23.83.209.66, mailfrom: jwatt@jwatt.org) Received: from gecko.birch.relay.mailchannels.net (gecko.birch.relay.mailchannels.net [23.83.209.66]) by groups.io with SMTP; Mon, 06 May 2019 06:03:08 -0700 X-Sender-Id: dreamhost|x-authsender|jwatt@jwatt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 7DAC66A1B51; Mon, 6 May 2019 13:03:07 +0000 (UTC) Received: from pdx1-sub0-mail-a76.g.dreamhost.com (100-96-79-5.trex.outbound.svc.cluster.local [100.96.79.5]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id CEA4D6A2107; Mon, 6 May 2019 13:03:06 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jwatt@jwatt.org Received: from pdx1-sub0-mail-a76.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.2); Mon, 06 May 2019 13:03:07 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jwatt@jwatt.org X-MailChannels-Auth-Id: dreamhost X-Bottle-Occur: 432924063d86df67_1557147787277_3759120615 X-MC-Loop-Signature: 1557147787277:3705019907 X-MC-Ingress-Time: 1557147787276 Received: from pdx1-sub0-mail-a76.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a76.g.dreamhost.com (Postfix) with ESMTP id B102780212; Mon, 6 May 2019 06:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jwatt.org; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=jwatt.org; bh=wpal1fkUZGYlOPPr7S7T 4L4XexM=; b=UbFylA1+B04UHjJdLZhkUxbRJlDUKpUF1ZmvJLcj3sViRUkd3Km5 8sXNoamcCMFM+jjQt1t6Gqi597/eWL5gwxy5LMar5UqoGr+hPemVHv3/LasLnMmN HISzENRWlnLrNmkz/lBDWy5jTsy63LJaykGXVIbc+gbyNjLgxTraP04= Received: from 82.40.106.149 (cpc120804-nrwh12-2-0-cust660.4-4.cable.virginm.net [82.40.106.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jwatt@jwatt.org) by pdx1-sub0-mail-a76.g.dreamhost.com (Postfix) with ESMTPSA id F26CE800E6; Mon, 6 May 2019 06:02:59 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a76 From: "Jonathan Watt" To: devel@edk2.groups.io Cc: Jaben Carsey , Ray Ni Subject: [PATCH v1 1/1] ShellPkg/UefiShellBcfgCommandLib: Fix '-opt' option Date: Mon, 6 May 2019 14:02:57 +0100 Message-Id: <20190506130257.80722-2-jwatt@jwatt.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506130257.80722-1-jwatt@jwatt.org> References: <20190506130257.80722-1-jwatt@jwatt.org> MIME-Version: 1.0 X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrjeejgdeiudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepjhifrghtthesjhifrghtthdrohhrghenucfkphepkedvrdegtddruddtiedrudegleenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepkedvrdegtddruddtiedrudegledpihhnvghtpeekvddrgedtrddutdeirddugeelpdhrvghtuhhrnhdqphgrthhhpehjfigrthhtsehjfigrthhtrdhorhhgpdhmrghilhhfrhhomhepjhifrghtthesjhifrghtthdrohhrghdpnhhrtghpthhtoheprhgrhidrnhhisehinhhtvghlrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd Content-Transfer-Encoding: quoted-printable From: Jonathan Watt For all other bcfg commands the "#" (option number) argument(s) are treated as hexedecimal values regardless of whether or not they are prefixed by "0x". This change fixes '-opt' to handle its "#" (option number) argument consistently with the other commands. Making this change removes a potential footgun whereby a user that has been using a number without a "0x" prefix with other bcfg commands finds that, on using that exact same number with '-opt', it has this time unexpectedly been interpreted as a decimal number and they have modified (corrupted) an unrelated load option. For example, a user may have been specifying "10" to other commands to have them act on the 16th option (because simply "10", without any prefix, is how 'bcfg boot dump' displayed the option number for the 16th option). Unfortunately for them, if they also use '-opt' with "10" it would unexpectedly and inconsistently act on the 10th option. CC: Jaben Carsey CC: Ray Ni Signed-off-by: Jonathan Watt --- ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c | 2 += - 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgComman= dLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib= .c index d033c7c1dc59..e8b48b4990dd 100644 --- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c +++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c @@ -1019,7 +1019,7 @@ BcfgAddOpt( // // Get the index of the variable we are changing. // - Status =3D ShellConvertStringToUint64(Walker, &Intermediate, FALSE, TR= UE); + Status =3D ShellConvertStringToUint64(Walker, &Intermediate, TRUE, TRU= E); if (EFI_ERROR(Status) || (((UINT16)Intermediate) !=3D Intermediate) ||= StrStr(Walker, L" ") =3D=3D NULL || ((UINT16)Intermediate) > ((UINT16)Or= derCount)) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShe= llBcfgHiiHandle, L"bcfg", L"Option Index"); ShellStatus =3D SHELL_INVALID_PARAMETER; --=20 2.21.0