From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=68.232.153.96; helo=esa7.dell-outbound.iphmx.com; envelope-from=jim.dailey@dell.com; receiver=edk2-devel@lists.01.org Received: from esa7.dell-outbound.iphmx.com (esa7.dell-outbound.iphmx.com [68.232.153.96]) (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 24A36210DA7A8 for ; Wed, 8 Aug 2018 06:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1533734656; x=1565270656; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ytoMJzbYxktJ/s3sJ2cX3xcmPHNOB37tyl93CHmFX5s=; b=pqyTvKWMO1KikT64y27Ci3/VZiYOlOcpb7YfaWNjas0jZkvpxuCBf8Sc FoMBVTEQbjkgE5UVy6iT/A97285zVmEantUCmWtPfOna6k1nxJ81JbnmA AdZo7OMcoc2yLe11DRF0siNAPXrujhdGDExKo4VpRIygGlwnps2wGEiqp U=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2FdAACI7WpbhyWd50NcGgEBAQEBAgE?= =?us-ascii?q?BAQEIAQEBAYQxfygKi39fi2GCDYF2k3uBegsYC4RJAoMSITQYAQIBAQIBAQI?= =?us-ascii?q?BAQIQAQEBCgsJCCkjDII1IoFFLA1jAQEBBAERFRM/DAQCAQgRBAEBHwkHKB4?= =?us-ascii?q?JCAIEDgUIGoJ+AYIAD6A8iVcBAQGBaDOKUwWCLYZngheDdi6DGwQYghSFCQK?= =?us-ascii?q?HfIR8hSyIIQcChhyFPINpgVeHGoVDinWEcIJpAgQCBAUCFIFBggtwgzmCM4g?= =?us-ascii?q?3K4U+bwGNIIEbAQE?= X-IPAS-Result: =?us-ascii?q?A2FdAACI7WpbhyWd50NcGgEBAQEBAgEBAQEIAQEBAYQxf?= =?us-ascii?q?ygKi39fi2GCDYF2k3uBegsYC4RJAoMSITQYAQIBAQIBAQIBAQIQAQEBCgsJC?= =?us-ascii?q?CkjDII1IoFFLA1jAQEBBAERFRM/DAQCAQgRBAEBHwkHKB4JCAIEDgUIGoJ+A?= =?us-ascii?q?YIAD6A8iVcBAQGBaDOKUwWCLYZngheDdi6DGwQYghSFCQKHfIR8hSyIIQcCh?= =?us-ascii?q?hyFPINpgVeHGoVDinWEcIJpAgQCBAUCFIFBggtwgzmCM4g3K4U+bwGNIIEbA?= =?us-ascii?q?QE?= Received: from mx0b-00154901.pphosted.com ([67.231.157.37]) by esa7.dell-outbound.iphmx.com with ESMTP/TLS/AES256-SHA256; 08 Aug 2018 08:24:14 -0500 Received: from pps.filterd (m0144102.ppops.net [127.0.0.1]) by mx0b-00154901.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w78DMxSS078193 for ; Wed, 8 Aug 2018 09:24:18 -0400 Received: from esa3.dell-outbound2.iphmx.com (esa3.dell-outbound2.iphmx.com [68.232.154.63]) by mx0b-00154901.pphosted.com with ESMTP id 2kqtu4j46h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 08 Aug 2018 09:24:18 -0400 From: Received: from ausxipps310.us.dell.com ([143.166.148.211]) by esa3.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 08 Aug 2018 19:23:45 +0600 X-LoopCount0: from 10.166.136.211 X-IronPort-AV: E=Sophos;i="5.51,457,1526360400"; d="scan'208";a="220981261" To: CC: , Thread-Topic: [PATCH v2] ShellPkg/set: Fix EfiShellSetEnv to use case sensitive compare Thread-Index: AQHULtUiePMZ5Itkd0aQasJ7C5ycH6S12AVg Date: Wed, 8 Aug 2018 13:24:15 +0000 Message-ID: <6cdd2af4881441638ecc57c1eac67b0d@ausx13mps335.AMER.DELL.COM> References: <20180808050339.74152-1-ruiyu.ni@intel.com> In-Reply-To: <20180808050339.74152-1-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Enabled=True; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_SiteId=945c199a-83a2-4e80-9f8c-5a91be5752dd; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Owner=Jim_Dailey@Dell.com; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_SetDate=2018-08-08T13:22:56.5050994Z; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Name=External Public; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Application=Microsoft Azure Information Protection; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Extended_MSFT_Method=Manual; Sensitivity=External Public x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.143.18.86] MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-08-08_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=941 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808080139 Subject: Re: [PATCH v2] ShellPkg/set: Fix EfiShellSetEnv to use case sensitive compare X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2018 13:24:21 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jim Dailey -----Original Message----- From: Ruiyu Ni [mailto:ruiyu.ni@intel.com]=20 Sent: Wednesday, August 8, 2018 12:04 AM To: edk2-devel@lists.01.org Cc: Jaben Carsey; Dailey, Jim Subject: [PATCH v2] ShellPkg/set: Fix EfiShellSetEnv to use case sensitive = compare REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D777 Per Shell spec, the environment variable has a case-sensitive name. But today's implementation of EfiShellSetEnv() compares the environment variable name case insensitively, which causes variable like "CWD" cannot be set due to "cwd" is pre-defined variable. The patch fixes this issue. The EfiShellGetEnv() doesn't have such issue because it will call into ShellFindEnvVarInList() which uses StrCmp(). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Jaben Carsey Cc: Jim Dailey --- ShellPkg/Application/Shell/ShellProtocol.c | 39 +++++++-------------------= ---- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Applicat= ion/Shell/ShellProtocol.c index f2ca2029e3..9e9e6dc052 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -2924,36 +2924,15 @@ EfiShellSetEnv( // // Make sure we dont 'set' a predefined read only variable // - if (gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)Name, - L"cwd") =3D=3D 0 - ||gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)Name, - L"Lasterror") =3D=3D 0 - ||gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)Name, - L"profiles") =3D=3D 0 - ||gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)Name, - L"uefishellsupport") =3D=3D 0 - ||gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)Name, - L"uefishellversion") =3D=3D 0 - ||gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)Name, - L"uefiversion") =3D=3D 0 - ||(!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest && - gUnicodeCollation->StriColl( - gUnicodeCollation, - (CHAR16*)Name, - (CHAR16*)mNoNestingEnvVarName) =3D=3D 0) - ){ + if ((StrCmp (Name, L"cwd") =3D=3D 0) || + (StrCmp (Name, L"lasterror") =3D=3D 0) || + (StrCmp (Name, L"profiles") =3D=3D 0) || + (StrCmp (Name, L"uefishellsupport") =3D=3D 0) || + (StrCmp (Name, L"uefishellversion") =3D=3D 0) || + (StrCmp (Name, L"uefiversion") =3D=3D 0) || + (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoNest && + StrCmp (Name, mNoNestingEnvVarName) =3D=3D 0) + ) { return (EFI_INVALID_PARAMETER); } return (InternalEfiShellSetEnv(Name, Value, Volatile)); --=20 2.16.1.windows.1