diff options
author | Jim.Dailey@dell.com <Jim.Dailey@dell.com> | 2018-10-06 03:14:56 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2018-10-24 13:36:35 +0800 |
commit | b08b045ca9ab46f335d2edc21eeea5340a1aea6b (patch) | |
tree | 0c7e6da96fd638e7b409ea53927e936894e86035 /MdePkg | |
parent | add1310df55eede2f52f44a021802831c683577d (diff) | |
download | edk2-b08b045ca9ab46f335d2edc21eeea5340a1aea6b.tar.gz edk2-b08b045ca9ab46f335d2edc21eeea5340a1aea6b.tar.bz2 edk2-b08b045ca9ab46f335d2edc21eeea5340a1aea6b.zip |
MdePkg-BaseLib: Fix PathCleanUpDirectories() issue with "\\..\\.."
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>
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Library/BaseLib/FilePaths.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/MdePkg/Library/BaseLib/FilePaths.c b/MdePkg/Library/BaseLib/FilePaths.c index ce6b3720d5..92e4c350ff 100644 --- a/MdePkg/Library/BaseLib/FilePaths.c +++ b/MdePkg/Library/BaseLib/FilePaths.c @@ -87,6 +87,13 @@ PathCleanUpDirectories( }
//
+ // Replace the "\\" with "\"
+ //
+ while ((TempString = StrStr (Path, L"\\\\")) != NULL) {
+ CopyMem (TempString, TempString + 1, StrSize (TempString + 1));
+ }
+
+ //
// Remove all the "\.". E.g.: fs0:\abc\.\def\.
//
while ((TempString = StrStr (Path, L"\\.\\")) != NULL) {
@@ -109,13 +116,6 @@ PathCleanUpDirectories( }
}
- //
- // Replace the "\\" with "\"
- //
- while ((TempString = StrStr (Path, L"\\\\")) != NULL) {
- CopyMem (TempString, TempString + 1, StrSize (TempString + 1));
- }
-
return Path;
}
|