diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-04-11 08:23:44 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-04-11 08:23:44 (GMT) |
commit | 09e3a3c56b5d44c637c6ed0593257e51461e8861 (patch) | |
tree | dfc3b46957b430685b72d2a8c327fc6be0ea9aac /win | |
parent | c21a540c4153d8738dadc191a3b2d6516990c108 (diff) | |
download | tcl-09e3a3c56b5d44c637c6ed0593257e51461e8861.zip tcl-09e3a3c56b5d44c637c6ed0593257e51461e8861.tar.gz tcl-09e3a3c56b5d44c637c6ed0593257e51461e8861.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.c | 8 |
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 = '\\'; } } |