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 7368121B02822 for ; Thu, 4 Oct 2018 08:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1538665411; x=1570201411; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=EAZTVSk6OFFvt3IT3K3LFhsBPbzzbQJnzHJ7UHpMDlg=; b=Bg+YFOuBhI+e5XBsPLHri0079plNmBFtvDnvb9NasebuG1wqHON01w30 RwPZWZq7RVFrirMO+10AkRiaHs2FFZRc+DjhxFqH5rjPSoLeraLKJWuOa 46MBaPAtmY1OXyr3bbLoPkYMSq/j1MN145cHpHxzRNVJL/b1tKEHl6E+I E=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2EIAAAPK7ZbhyeV50NcGwEBAQEDAQE?= =?us-ascii?q?BBwMBAQGBUQYBAQELAYNYEigKi39fnygfhGQUgWYLAQGEbIRJNA0NAQMBAQI?= =?us-ascii?q?BAQIBAQIQAQEBFQkIKS+CNiKCZRYoPxIBPmgBBA4FCBqCf4ICmVaJVwEBAYI?= =?us-ascii?q?bihSCLodhgzSIZwSBBIULAo4pjy4HApA4H49rlTgCBAIEBQIUgUI3gVdwgzy?= =?us-ascii?q?CMxoZjW5vixeBLoEfAQE?= X-IPAS-Result: =?us-ascii?q?A2EIAAAPK7ZbhyeV50NcGwEBAQEDAQEBBwMBAQGBUQYBA?= =?us-ascii?q?QELAYNYEigKi39fnygfhGQUgWYLAQGEbIRJNA0NAQMBAQIBAQIBAQIQAQEBF?= =?us-ascii?q?QkIKS+CNiKCZRYoPxIBPmgBBA4FCBqCf4ICmVaJVwEBAYIbihSCLodhgzSIZ?= =?us-ascii?q?wSBBIULAo4pjy4HApA4H49rlTgCBAIEBQIUgUI3gVdwgzyCMxoZjW5vixeBL?= =?us-ascii?q?oEfAQE?= Received: from mx0a-00154901.pphosted.com (HELO mx0b-00154901.pphosted.com) ([67.231.149.39]) by esa7.dell-outbound.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Oct 2018 10:03:29 -0500 Received: from pps.filterd (m0090350.ppops.net [127.0.0.1]) by mx0b-00154901.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w94F3UJW080139 for ; Thu, 4 Oct 2018 11:03:32 -0400 Received: from esa5.dell-outbound2.iphmx.com (esa5.dell-outbound2.iphmx.com [68.232.153.203]) by mx0b-00154901.pphosted.com with ESMTP id 2mwfe4hye0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 04 Oct 2018 11:03:31 -0400 From: Received: from ausxippc106.us.dell.com ([143.166.85.156]) by esa5.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 04 Oct 2018 21:03:19 +0600 X-LoopCount0: from 10.166.136.217 X-IronPort-AV: E=Sophos;i="5.54,340,1534827600"; d="scan'208";a="301122260" To: CC: , Thread-Topic: [edk2] [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() error involving "\..\.." Thread-Index: AdRb8u+fPosX/3+9QWuBYG0QrhUEYw== Date: Thu, 4 Oct 2018 15:03:28 +0000 Message-ID: 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-10-04T14:58:58.7614687Z; 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.242.75] MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-04_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810040141 Subject: [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() error involving "\..\.." 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: Thu, 04 Oct 2018 15:03:34 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MdePkg-BaseLib: Fix PathCleanUpDirectories() error involving "\..\.." The loop that removes "xxxx\..\" errs when multiple "\.." sequences are in the path. Before this change the code would modify a path like "FS0:\efi\tools\..\.." to "FS0:\efi\\.." and then to "FS0:\efi\", but the correct path is "FS0:\". You can test the effect of this change in the shell by setting the current directory to something like FS0:\efi\boot and then executing the command "ls ..\..". Before the change you will see the files in the FS0:\efi directory; after the change, you will see the files in the root directory of FS0:. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jim Dailey --- MdePkg/Library/BaseLib/FilePaths.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MdePkg/Library/BaseLib/FilePaths.c b/MdePkg/Library/BaseLib/Fi= lePaths.c index d6f3758ecb..5d3de01894 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 BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -103,7 +104,9 @@ PathCleanUpDirectories( ) { *(TempString + 1) =3D CHAR_NULL; PathRemoveLastItem(Path); - CopyMem (Path + StrLen (Path), TempString + 3, StrSize (TempString + 3= )); + if (*(TempString + 3)) { + CopyMem (Path + StrLen (Path), TempString + 4, StrSize (TempString += 4)); + } } =20 // --=20 2.17.0.windows.1