Reviewed-by: Samer El-Haj-Mahmoud <el...@hp.com>

-----Original Message-----
From: Qiu Shumin [mailto:shumin....@intel.com] 
Sent: Monday, June 29, 2015 8:55 PM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] [PATCH] 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.

Signed-off-by: Qiu Shumin <shumin....@intel.com>
Reviewed-by: Jaben Carsey <jaben.car...@intel.com>
---
 ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c 
b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
index c025ceb..cf6d3a5 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
@@ -2,7 +2,7 @@
   Main file for mv shell level 2 function.
 
   (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights 
+ reserved.<BR>
   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 @@ -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);
--
1.9.5.msysgit.1



------------------------------------------------------------------------------
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-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
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-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to