mirror of https://github.com/acidanthera/audk.git
ShellPkg: Refine the code logic of mv.c.
When doing the mv we should check whether source is 'above' dest on file path tree. This patch make the check logic more precise. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hp.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17750 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
203beadc12
commit
2ce8ce9b06
|
@ -128,8 +128,10 @@ IsValidMove(
|
||||||
//
|
//
|
||||||
// If they're the same, or if source is "above" dest on file path tree
|
// If they're the same, or if source is "above" dest on file path tree
|
||||||
//
|
//
|
||||||
if ( StringNoCaseCompare (&DestPathWalker, &SourcePath) == 0
|
if ( StringNoCaseCompare (&DestPathWalker, &SourcePath) == 0 ||
|
||||||
|| StrStr(DestPathWalker, SourcePath) == DestPathWalker
|
((StrStr(DestPathWalker, SourcePath) == DestPathWalker) &&
|
||||||
|
(DestPathWalker[StrLen(SourcePath)] == '\\')
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MV_INV_SUB), gShellLevel2HiiHandle);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MV_INV_SUB), gShellLevel2HiiHandle);
|
||||||
FreePool(DestPathCopy);
|
FreePool(DestPathCopy);
|
||||||
|
|
Loading…
Reference in New Issue