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>
This commit is contained in:
Jim.Dailey@dell.com 2018-10-06 03:14:56 +08:00 committed by Ruiyu Ni
parent add1310df5
commit b08b045ca9
1 changed files with 7 additions and 7 deletions

View File

@ -86,6 +86,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\.
//
@ -109,13 +116,6 @@ PathCleanUpDirectories(
}
}
//
// Replace the "\\" with "\"
//
while ((TempString = StrStr (Path, L"\\\\")) != NULL) {
CopyMem (TempString, TempString + 1, StrSize (TempString + 1));
}
return Path;
}