mirror of https://github.com/acidanthera/audk.git
MdePkg-BaseLib: Fix PathCleanUpDirectories() error involving "\..\.."
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> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
parent
8122c6bc8b
commit
7177be0bd8
|
@ -2,6 +2,7 @@
|
||||||
Defines file-path manipulation functions.
|
Defines file-path manipulation functions.
|
||||||
|
|
||||||
Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -103,7 +104,9 @@ PathCleanUpDirectories(
|
||||||
) {
|
) {
|
||||||
*(TempString + 1) = CHAR_NULL;
|
*(TempString + 1) = CHAR_NULL;
|
||||||
PathRemoveLastItem(Path);
|
PathRemoveLastItem(Path);
|
||||||
CopyMem (Path + StrLen (Path), TempString + 3, StrSize (TempString + 3));
|
if (*(TempString + 3) != CHAR_NULL) {
|
||||||
|
CopyMem (Path + StrLen (Path), TempString + 4, StrSize (TempString + 4));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue