summaryrefslogtreecommitdiffstats
path: root/win/tclWinFile.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2014-05-15 14:59:03 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2014-05-15 14:59:03 (GMT)
commit80d6e099f04cbbbf778e8efd20507f8b4902fda6 (patch)
tree862f690c38df2930e5df696e4533632e964b3ea4 /win/tclWinFile.c
parent8637f1738357b93644912a7f4c3f302828a4ea0c (diff)
parent47b1f4425678fcc051e9a75f59f6c4cd4f21b176 (diff)
downloadtcl-80d6e099f04cbbbf778e8efd20507f8b4902fda6.zip
tcl-80d6e099f04cbbbf778e8efd20507f8b4902fda6.tar.gz
tcl-80d6e099f04cbbbf778e8efd20507f8b4902fda6.tar.bz2
Minor bug-fix in [3118489] implementation: NUL in filenames. Filenames starting with <drive>: but without a following slash should be considered volume-relative i.e. the ':' is valid here.
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r--win/tclWinFile.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 5761eeb..ad4a5c4 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -2962,18 +2962,17 @@ TclNativeCreateNativeRep(
** <http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maxpath>
**/
if (((str[0]>='A'&&str[0]<='Z') || (str[0]>='a'&&str[0]<='z'))
- && str[1]==':' && (str[2]=='\\' || str[2]=='/')) {
- if (wp==nativePathPtr && len>MAX_PATH) {
+ && str[1]==':') {
+ if (wp==nativePathPtr && len>MAX_PATH && (str[2]=='\\' || str[2]=='/')) {
memmove(wp+4, wp, len*sizeof(WCHAR));
memcpy(wp, L"\\\\?\\", 4*sizeof(WCHAR));
wp += 4;
}
/*
- ** If (remainder of) path starts with "<drive>:/" or "<drive>:\",
- ** leave the ':' intact but translate the backslash to a slash.
+ ** If (remainder of) path starts with "<drive>:",
+ ** leave the ':' intact.
*/
- wp[2] = '\\';
- wp += 3;
+ wp += 2;
} else if (wp==nativePathPtr && len>MAX_PATH
&& (str[0]=='\\' || str[0]=='/')
&& (str[1]=='\\' || str[1]=='/') && str[2]!='?') {