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);