summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2016-08-05 13:12:56 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2016-08-10 10:17:08 +0800
commitd25d59cb7ee608deb60137389c2461c6d937f669 (patch)
treeabf1d4ea7ae07febaed49fc89d61ef653dcd86a8 /ShellPkg
parentdb2e266a0e926be03fb0e6c86fadf121532912d1 (diff)
ShellPkg: Fix FindFiles() to handle "fsx:EFI\BOOT" path
When the FilePattern is similar to "fsx:EFI\BOOT", FindFiles() cannot handle it correctly because it always assumes there is "\\" after "fsx:". Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Tapan Shah <tapandshah@hpe.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Application/Shell/ShellProtocol.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
index 55a1e43f06..0e5d954e45 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -2434,15 +2434,14 @@ ShellSearchHandle(
){
if (UnicodeCollation->MetaiMatch(UnicodeCollation, (CHAR16*)ShellInfoNode->FileName, CurrentFilePattern)){
if (ShellInfoNode->FullName != NULL && StrStr(ShellInfoNode->FullName, L":") == NULL) {
- Size = StrSize(ShellInfoNode->FullName);
- Size += StrSize(MapName) + sizeof(CHAR16);
+ Size = StrSize (ShellInfoNode->FullName) + StrSize (MapName);
NewFullName = AllocateZeroPool(Size);
if (NewFullName == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
- StrCpyS(NewFullName, Size/sizeof(CHAR16), MapName);
- StrCatS(NewFullName, Size/sizeof(CHAR16), ShellInfoNode->FullName+1);
- FreePool((VOID*)ShellInfoNode->FullName);
+ StrCpyS(NewFullName, Size / sizeof(CHAR16), MapName);
+ StrCatS(NewFullName, Size / sizeof(CHAR16), ShellInfoNode->FullName);
+ FreePool ((VOID *) ShellInfoNode->FullName);
ShellInfoNode->FullName = NewFullName;
}
}
@@ -2572,8 +2571,8 @@ EfiShellFindFiles(
PatternCopy = PathCleanUpDirectories(PatternCopy);
- Count = StrStr(PatternCopy, L":") - PatternCopy;
- Count += 2;
+ Count = StrStr(PatternCopy, L":") - PatternCopy + 1;
+ ASSERT (Count <= StrLen (PatternCopy));
ASSERT(MapName == NULL);
MapName = StrnCatGrow(&MapName, NULL, PatternCopy, Count);