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.88; helo=mga01.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 87FC22115F51F for ; Sun, 7 Oct 2018 23:59:22 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Oct 2018 23:59:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,355,1534834800"; d="scan'208";a="79581932" Received: from ray-dev.ccr.corp.intel.com (HELO [10.239.9.11]) ([10.239.9.11]) by orsmga008.jf.intel.com with ESMTP; 07 Oct 2018 23:59:20 -0700 To: Jim.Dailey@dell.com, edk2-devel@lists.01.org Cc: michael.d.kinney@intel.com, liming.gao@intel.com References: From: "Ni, Ruiyu" Message-ID: <7a3d9037-6525-32a2-b244-b382d69972e4@Intel.com> Date: Mon, 8 Oct 2018 15:00:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Subject: Re: [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: Mon, 08 Oct 2018 06:59:22 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 10/4/2018 11:03 PM, Jim.Dailey@dell.com wrote: > 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/FilePaths.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. > > 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 > @@ -103,7 +104,9 @@ PathCleanUpDirectories( > ) { > *(TempString + 1) = 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)); > + } > } > > // > Jim, Are you fixing a corner case bug introduced by following commit: > SHA-1: bb99e3282c9e69fbd6365d117c58d15589e34c5d * MdePkg/BaseLib: Fix PathCleanUpDirectories to correctly handle "\.\" > The old code incorrectly cleans path like "fs0:\abc\.\.." to > "fs0:\abc", instead of "fs0:\" > The patch fixes this bug. If yes, can you mention the above commit in your commit message? -- Thanks, Ray