summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2014-04-11 08:23:44 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2014-04-11 08:23:44 (GMT)
commitd10806530dadbab97eca8462f1f3a881a8cdcf7a (patch)
treedfc3b46957b430685b72d2a8c327fc6be0ea9aac /win
parentc867dfd034075a466891ee7e0bb4db6a8e9be8ea (diff)
downloadtcl-d10806530dadbab97eca8462f1f3a881a8cdcf7a.zip
tcl-d10806530dadbab97eca8462f1f3a881a8cdcf7a.tar.gz
tcl-d10806530dadbab97eca8462f1f3a881a8cdcf7a.tar.bz2
Fix [3118489] for Windows only: NUL in filenames. This allows various characters to be used in win32 filenames which are normally invalid, as described here: [http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars]. The Cygwin shell can handle those same filenames as well. In other shells (cmd.exe/mSys) or on the Windows desktop the filenames will look strange, but that's all.
Diffstat (limited to 'win')
-rw-r--r--win/tclWinFile.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 80d0915..c9b95a0 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -2897,7 +2897,7 @@ TclNativeCreateNativeRep(
char *nativePathPtr, *str;
Tcl_DString ds;
Tcl_Obj *validPathPtr;
- int len;
+ int len, i = 2;
WCHAR *wp;
if (TclFSCwdIsNative()) {
@@ -2927,8 +2927,10 @@ TclNativeCreateNativeRep(
Tcl_WinUtfToTChar(str, len, &ds);
len = Tcl_DStringLength(&ds) + sizeof(WCHAR);
wp = (WCHAR *) Tcl_DStringValue(&ds);
- for (; *wp; ++wp) {
- if (*wp=='/') {
+ for (i=sizeof(WCHAR); i<len; ++wp,i+=sizeof(WCHAR)) {
+ if ( (*wp < ' ') || wcschr(L"\"*<>|", *wp) ){
+ *wp |= 0xF000;
+ }else if (*wp=='/') {
*wp = '\\';
}
}