From a32980dd3cd4e8f3fce521e51bdf2e27c418d1db Mon Sep 17 00:00:00 2001 From: jcarsey Date: Fri, 20 Jan 2012 18:10:45 +0000 Subject: [PATCH] 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 --- ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c | 7 +++++-- 1 file 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.
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
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; -- 2.39.2