summaryrefslogtreecommitdiffstats
path: root/win/tclWinFile.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r--win/tclWinFile.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index c9b95a0..fc0ac9e 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1816,6 +1816,9 @@ TclpObjChdir(
nativePath = Tcl_FSGetNativePath(pathPtr);
+ if (!nativePath) {
+ return -1;
+ }
result = SetCurrentDirectory(nativePath);
if (result == 0) {
@@ -2929,6 +2932,12 @@ TclNativeCreateNativeRep(
wp = (WCHAR *) Tcl_DStringValue(&ds);
for (i=sizeof(WCHAR); i<len; ++wp,i+=sizeof(WCHAR)) {
if ( (*wp < ' ') || wcschr(L"\"*<>|", *wp) ){
+ if (!*wp){
+ /* See bug [3118489]: NUL in filenames */
+ Tcl_DecrRefCount(validPathPtr);
+ Tcl_DStringFree(&ds);
+ return NULL;
+ }
*wp |= 0xF000;
}else if (*wp=='/') {
*wp = '\\';