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.90; helo=esa1.dell-outbound.iphmx.com; envelope-from=jim.dailey@dell.com; receiver=edk2-devel@lists.01.org Received: from esa1.dell-outbound.iphmx.com (esa1.dell-outbound.iphmx.com [68.232.153.90]) (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 DAE7F21A143EF for ; Fri, 5 Oct 2018 12:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1538766886; x=1570302886; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=eYwu375owV79djpbZaFMBJ2tkjS8GpqF5V3Vn0GuP7A=; b=siH69AIy5RamJvWhUOOToZlV+0xSEhLiTNT+VKkE8aIwXcdvSfnwCCKQ Fq74ZY6z905/3I2PctNkAHiSs9Bxg6umJzrYj1ErVUCdxhoab1vm0z5ff 79TVf62m7y/vN0jxfQI1wVHbotkJxdjN5T6rKg4muY99h5sfFcf6afa+m 4=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2EJAABYt7dbhyWd50NjGwEBAQEDAQE?= =?us-ascii?q?BBwMBAQGBUQYBAQELAYNqKAqLf1+fLx+EZBSBZgsBAYRshDIhNA0NAQMBAQI?= =?us-ascii?q?BAQIBAQIQAQEBFQkIKS+CNiKCZRYoPxIBPmgBBA4FCBqCf4ICmj2JVwEBAYI?= =?us-ascii?q?bihmCLodmgR2CF4ESh1WBCIULAo4sjzYHApA+H490lT8CBAIEBQIUgUI3gVd?= =?us-ascii?q?wgzyCNBoZjW5vjSeBHwEB?= X-IPAS-Result: =?us-ascii?q?A2EJAABYt7dbhyWd50NjGwEBAQEDAQEBBwMBAQGBUQYBA?= =?us-ascii?q?QELAYNqKAqLf1+fLx+EZBSBZgsBAYRshDIhNA0NAQMBAQIBAQIBAQIQAQEBF?= =?us-ascii?q?QkIKS+CNiKCZRYoPxIBPmgBBA4FCBqCf4ICmj2JVwEBAYIbihmCLodmgR2CF?= =?us-ascii?q?4ESh1WBCIULAo4sjzYHApA+H490lT8CBAIEBQIUgUI3gVdwgzyCNBoZjW5vj?= =?us-ascii?q?SeBHwEB?= Received: from mx0b-00154901.pphosted.com ([67.231.157.37]) by esa1.dell-outbound.iphmx.com with ESMTP/TLS/AES256-SHA256; 05 Oct 2018 14:14:44 -0500 Received: from pps.filterd (m0144104.ppops.net [127.0.0.1]) by mx0b-00154901.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w95J8fTf079394 for ; Fri, 5 Oct 2018 15:14:58 -0400 Received: from esa4.dell-outbound2.iphmx.com (esa4.dell-outbound2.iphmx.com [68.232.154.98]) by mx0b-00154901.pphosted.com with ESMTP id 2mx469u5qa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 05 Oct 2018 15:14:58 -0400 From: Received: from ausxipps310.us.dell.com ([143.166.148.211]) by esa4.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 06 Oct 2018 01:14:56 +0600 X-LoopCount0: from 10.166.136.214 X-IronPort-AV: E=Sophos;i="5.54,345,1534827600"; d="scan'208";a="260382681" To: CC: , Thread-Topic: [edk2] [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() issue with "\\..\\.." Thread-Index: AdRcxfJOhj5wPON1SDO1wGMOnK85sA== Date: Fri, 5 Oct 2018 19:14:56 +0000 Message-ID: <87e40160c8f14bc7991ea0a7406c7d1c@ausx13mps339.AMER.DELL.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-10-05T16:09:33.2088418Z; 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-10-05_09:, , 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=402 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810050184 Subject: [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: Fri, 05 Oct 2018 19:15:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Replace multiple, consecutive "\" characters prior to other processing involving "\" characters. This fixes an issue where "\\..\\..", "//..//..", and similar input paths are not cleaned properly. 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(-) diff --git a/MdePkg/Library/BaseLib/FilePaths.c b/MdePkg/Library/BaseLib/Fi= lePaths.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 BS= D License which accompanies this distribution. The full text of the license may b= e 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 --=20 2.17.0.windows.1