diff options
author | Brendan Jackman <Brendan.Jackman@arm.com> | 2014-01-24 22:32:38 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-01-24 22:32:38 +0000 |
commit | 6ddc2ff3efa00b0e2233ae28f64cf58d63dafd2a (patch) | |
tree | 4b5cf318e41f085a06b227769fe8768b1f7b46e1 /ShellPkg/Application | |
parent | 3877d0f581536430fffe572ec3ceea29e0d50602 (diff) | |
download | edk2-platforms-6ddc2ff3efa00b0e2233ae28f64cf58d63dafd2a.tar.xz |
ShellPkg/ShellProtocol.c: Don't put consective "\"s in file paths
The UEFI and UEFI Shell specs do not allow consecutive path separators.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15184 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Application')
-rw-r--r-- | ShellPkg/Application/Shell/ShellProtocol.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index 0d3839783e..fe63e6a8d6 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -458,9 +458,20 @@ EfiShellGetFilePathFromDevicePath( // append the path part onto the filepath.
//
ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL));
- PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, L"\\", 1);
AlignedNode = AllocateCopyPool (DevicePathNodeLength(FilePath), FilePath);
+
+ // File Path Device Path Nodes 'can optionally add a "\" separator to
+ // the beginning and/or the end of the Path Name string.'
+ // (UEFI Spec 2.4 section 9.3.6.4).
+ // If necessary, add a "\", but otherwise don't
+ // (This is specified in the above section, and also implied by the
+ // UEFI Shell spec section 3.7)
+ if ((PathForReturn[PathSize - 1] != L'\\') &&
+ (AlignedNode->PathName[0] != L'\\')) {
+ PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, L"\\", 1);
+ }
+
PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, AlignedNode->PathName, 0);
FreePool(AlignedNode);
}
|