summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2012-01-20 18:10:45 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2012-01-20 18:10:45 +0000
commita32980dd3cd4e8f3fce521e51bdf2e27c418d1db (patch)
tree26dd2dce29a4dcfebdb98836bb779f6c5ce8489a
parentecfd71af17316deefd3cd4eaa305016b6678109b (diff)
downloadedk2-a32980dd3cd4e8f3fce521e51bdf2e27c418d1db.tar.gz
edk2-a32980dd3cd4e8f3fce521e51bdf2e27c418d1db.tar.bz2
edk2-a32980dd3cd4e8f3fce521e51bdf2e27c418d1db.zip
ShellPkg: Fix rm CWD protection to be better at catching similarly named directories.
signed-off-by: jcarsey reviewed-by: geekboy15a git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12950 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
index 32b7580103..d167b36fb4 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
@@ -1,7 +1,7 @@
/** @file
Main file for attrib shell level 2 function.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@@ -202,7 +202,10 @@ IsValidDeleteTarget(
Size = 0;
Pattern = StrnCatGrow(&Pattern , NULL, TempLocation , 0);
SearchString = StrnCatGrow(&SearchString, &Size, Node->FullName, 0);
- SearchString = StrnCatGrow(&SearchString, &Size, L"*", 0);
+ if (!EFI_ERROR(ShellIsDirectory(SearchString))) {
+ SearchString = StrnCatGrow(&SearchString, &Size, L"\\", 0);
+ SearchString = StrnCatGrow(&SearchString, &Size, L"*", 0);
+ }
if (Pattern == NULL || SearchString == NULL) {
RetVal = FALSE;