summaryrefslogtreecommitdiffstats
path: root/win/tclWinFCmd.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-06-02 15:58:45 (GMT)
committervincentdarley <vincentdarley>2003-06-02 15:58:45 (GMT)
commit753ae00890d0e80ad9d637fea2871c566e67bb17 (patch)
tree94b30a67a604eb763213f7df1908a1b51a649906 /win/tclWinFCmd.c
parentac8bb107ca7d45115b1877f6ed9d25b16456b4b4 (diff)
downloadtcl-753ae00890d0e80ad9d637fea2871c566e67bb17.zip
tcl-753ae00890d0e80ad9d637fea2871c566e67bb17.tar.gz
tcl-753ae00890d0e80ad9d637fea2871c566e67bb17.tar.bz2
fix to WinTcl file rename error message
Diffstat (limited to 'win/tclWinFCmd.c')
-rw-r--r--win/tclWinFCmd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index 621d352..3f2addb 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinFCmd.c,v 1.35 2003/02/07 15:29:33 vincentdarley Exp $
+ * RCS: @(#) $Id: tclWinFCmd.c,v 1.36 2003/06/02 15:58:47 vincentdarley Exp $
*/
#include "tclWinInt.h"
@@ -302,7 +302,15 @@ DoRenameFile(
src = Tcl_WinTCharToUtf((TCHAR *) nativeSrcPath, -1, &srcString);
dst = Tcl_WinTCharToUtf((TCHAR *) nativeDstPath, -1, &dstString);
- if (strncmp(src, dst, (size_t) Tcl_DStringLength(&srcString)) == 0) {
+ /*
+ * Check whether the destination path is actually inside the
+ * source path. This is true if the prefix matches, and the next
+ * character is either end-of-string or a directory separator
+ */
+ if ((strncmp(src, dst, (size_t) Tcl_DStringLength(&srcString)) == 0)
+ && (dst[Tcl_DStringLength(&srcString)] == '\\'
+ || dst[Tcl_DStringLength(&srcString)] == '/'
+ || dst[Tcl_DStringLength(&srcString)] == '\0')) {
/*
* Trying to move a directory into itself.
*/