public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdePkg-BaseLib: PathCleanUpDirectories fix
@ 2018-11-30 15:11 Jim.Dailey
  2018-11-30 15:43 ` Jim.Dailey
  0 siblings, 1 reply; 3+ messages in thread
From: Jim.Dailey @ 2018-11-30 15:11 UTC (permalink / raw)
  To: liming.gao, michael.d.kinney; +Cc: edk2-devel


PathCleanUpDirectories does not handle "<dir>\..\<file>" properly; it
returns "<dir>\<file>" instead of "<file>".  This change fixes that
problem so that "<file>" is returned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jim Dailey <jim_dailey@dell.com>
---
 MdePkg/Library/BaseLib/FilePaths.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Library/BaseLib/FilePaths.c b/MdePkg/Library/BaseLib/FilePaths.c
index 92e4c350ff..69e46dd135 100644
--- a/MdePkg/Library/BaseLib/FilePaths.c
+++ b/MdePkg/Library/BaseLib/FilePaths.c
@@ -110,7 +110,12 @@ PathCleanUpDirectories(
          ((*(TempString + 3) == L'\\') || (*(TempString + 3) == CHAR_NULL))
         ) {
     *(TempString + 1) = CHAR_NULL;
-    PathRemoveLastItem(Path);
+    if (!PathRemoveLastItem(Path)) {
+      //
+      // We had "<somedir>\.."
+      //
+      *Path = CHAR_NULL;
+    }
     if (*(TempString + 3) != CHAR_NULL) {
       CopyMem (Path + StrLen (Path), TempString + 4, StrSize (TempString + 4));
     }
-- 
2.17.0.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-03 22:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-30 15:11 [PATCH] MdePkg-BaseLib: PathCleanUpDirectories fix Jim.Dailey
2018-11-30 15:43 ` Jim.Dailey
2018-12-03 22:06   ` Jim.Dailey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox