From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 670282194D3B3 for ; Tue, 23 Oct 2018 21:42:54 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2018 21:42:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,418,1534834800"; d="scan'208";a="243849850" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 23 Oct 2018 21:42:53 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 23 Oct 2018 21:42:53 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 23 Oct 2018 21:42:53 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.199]) with mapi id 14.03.0415.000; Wed, 24 Oct 2018 12:42:51 +0800 From: "Ni, Ruiyu" To: "Jim.Dailey@dell.com" , "edk2-devel@lists.01.org" CC: "Kinney, Michael D" , "Gao, Liming" Thread-Topic: [edk2] [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() issue with "\\..\\.." Thread-Index: AdRcxfJOhj5wPON1SDO1wGMOnK85sAOjjeQw Date: Wed, 24 Oct 2018 04:42:50 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BED03FC@SHSMSX104.ccr.corp.intel.com> References: <87e40160c8f14bc7991ea0a7406c7d1c@ausx13mps339.AMER.DELL.COM> In-Reply-To: <87e40160c8f14bc7991ea0a7406c7d1c@ausx13mps339.AMER.DELL.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] MdePkg-BaseLib: Fix PathCleanUpDirectories() issue with "\\..\\.." X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Oct 2018 04:42:54 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----Original Message----- > From: edk2-devel On Behalf Of > Jim.Dailey@dell.com > Sent: Saturday, October 6, 2018 3:15 AM > To: edk2-devel@lists.01.org > Cc: Kinney, Michael D ; Gao, Liming > > Subject: [edk2] [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() issu= e > with "\\..\\.." >=20 > Replace multiple, consecutive "\" characters prior to other processing > involving "\" characters. This fixes an issue where "\\..\\..", "//..//.= .", and > similar input paths are not cleaned properly. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jim Dailey > --- > MdePkg/Library/BaseLib/FilePaths.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) >=20 > diff --git a/MdePkg/Library/BaseLib/FilePaths.c > b/MdePkg/Library/BaseLib/FilePaths.c > index d6f3758ecb..c5ca0a3b77 100644 > --- a/MdePkg/Library/BaseLib/FilePaths.c > +++ b/MdePkg/Library/BaseLib/FilePaths.c > @@ -2,6 +2,7 @@ > Defines file-path manipulation functions. >=20 > Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
> + Copyright (c) 2018, Dell Technologies. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > which accompanies this distribution. The full text of the license may= be > found at @@ -85,6 +86,13 @@ PathCleanUpDirectories( > } > } >=20 > + // > + // Replace the "\\" with "\" > + // > + while ((TempString =3D StrStr (Path, L"\\\\")) !=3D NULL) { > + CopyMem (TempString, TempString + 1, StrSize (TempString + 1)); } > + > // > // Remove all the "\.". E.g.: fs0:\abc\.\def\. > // > @@ -106,13 +114,6 @@ PathCleanUpDirectories( > CopyMem (Path + StrLen (Path), TempString + 3, StrSize (TempString += 3)); > } >=20 > - // > - // Replace the "\\" with "\" > - // > - while ((TempString =3D StrStr (Path, L"\\\\")) !=3D NULL) { > - CopyMem (TempString, TempString + 1, StrSize (TempString + 1)); > - } > - > return Path; > } >=20 > -- > 2.17.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel