]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg-BaseLib: Fix PathCleanUpDirectories() issue with "\\..\\.."
authorJim.Dailey@dell.com <Jim.Dailey@dell.com>
Fri, 5 Oct 2018 19:14:56 +0000 (03:14 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 24 Oct 2018 05:36:35 +0000 (13:36 +0800)
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 <jim_dailey@dell.com>
Reviewed-by: Ruiyu Ni <Ruiyu.ni@Intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Library/BaseLib/FilePaths.c

index ce6b3720d5d4e513ae4c33c56473b8a81da2b0fc..92e4c350ff261f1e429d2db01f60579529fc1cd3 100644 (file)
@@ -86,6 +86,13 @@ PathCleanUpDirectories(
     }\r
   }\r
 \r
+  //\r
+  // Replace the "\\" with "\"\r
+  //\r
+  while ((TempString = StrStr (Path, L"\\\\")) != NULL) {\r
+    CopyMem (TempString, TempString + 1, StrSize (TempString + 1));\r
+  }\r
+\r
   //\r
   // Remove all the "\.". E.g.: fs0:\abc\.\def\.\r
   //\r
@@ -109,13 +116,6 @@ PathCleanUpDirectories(
     }\r
   }\r
 \r
-  //\r
-  // Replace the "\\" with "\"\r
-  //\r
-  while ((TempString = StrStr (Path, L"\\\\")) != NULL) {\r
-    CopyMem (TempString, TempString + 1, StrSize (TempString + 1));\r
-  }\r
-\r
   return Path;\r
 }\r
 \r