Revision: 17750
          http://sourceforge.net/p/edk2/code/17750
Author:   shenshushi
Date:     2015-07-01 01:46:20 +0000 (Wed, 01 Jul 2015)
Log Message:
-----------
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....@intel.com>
Reviewed-by: Jaben Carsey <jaben.car...@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <el...@hp.com>

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c

Modified: trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c 2015-07-01 
01:44:01 UTC (rev 17749)
+++ trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c 2015-07-01 
01:46:20 UTC (rev 17750)
@@ -128,9 +128,11 @@
   //
   // 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);


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to