summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
index 40ba00b493..fa67533743 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
@@ -128,9 +128,11 @@ IsValidMove(
//
// If they're the same, or if source is "above" dest on file path tree
//
- if ( StringNoCaseCompare (&DestPathWalker, &SourcePath) == 0
- || StrStr(DestPathWalker, SourcePath) == DestPathWalker
- ) {
+ if ( StringNoCaseCompare (&DestPathWalker, &SourcePath) == 0 ||
+ ((StrStr(DestPathWalker, SourcePath) == DestPathWalker) &&
+ (DestPathWalker[StrLen(SourcePath)] == '\\')
+ )
+ ) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MV_INV_SUB), gShellLevel2HiiHandle);
FreePool(DestPathCopy);
return (FALSE);