From: <Jim.Dailey@dell.com>
To: <edk2-devel@lists.01.org>
Cc: <michael.d.kinney@intel.com>, <liming.gao@intel.com>
Subject: [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() error involving "\..\.."
Date: Thu, 4 Oct 2018 15:03:28 +0000 [thread overview]
Message-ID: <a2441d2e80de4f0489ae8a7ee954e57d@ausx13mps335.AMER.DELL.COM> (raw)
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 <jim_dailey@dell.com>
---
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.<BR>
+ Copyright (c) 2018, Dell Technologies. All rights reserved.<BR>
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));
+ }
}
//
--
2.17.0.windows.1
next reply other threads:[~2018-10-04 15:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-04 15:03 Jim.Dailey [this message]
2018-10-08 7:00 ` [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() error involving "\..\.." Ni, Ruiyu
2018-10-08 13:23 ` Jim.Dailey
2018-10-09 2:55 ` Ni, Ruiyu
2018-10-09 11:40 ` Jim.Dailey
2018-10-08 15:26 ` Jim.Dailey
2018-10-08 15:46 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a2441d2e80de4f0489ae8a7ee954e57d@ausx13mps335.AMER.DELL.COM \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox