diff options
| author | oehhar <harald.oehlmann@elmicron.de> | 2015-05-31 16:20:06 (GMT) |
|---|---|---|
| committer | oehhar <harald.oehlmann@elmicron.de> | 2015-05-31 16:20:06 (GMT) |
| commit | b4cd8e5d9c83eca73067d437205f630c9406008b (patch) | |
| tree | d53d085f4f5d210127092023f92633ef57a090f6 /unix/tclUnixFile.c | |
| parent | a4ced94ae6dec9eb42f766a2362ae08d0211e103 (diff) | |
| parent | 450b7aafd002db79fc1564d5fed7773b3c88532c (diff) | |
| download | tcl-b4cd8e5d9c83eca73067d437205f630c9406008b.zip tcl-b4cd8e5d9c83eca73067d437205f630c9406008b.tar.gz tcl-b4cd8e5d9c83eca73067d437205f630c9406008b.tar.bz2 | |
merge trunk
Diffstat (limited to 'unix/tclUnixFile.c')
| -rw-r--r-- | unix/tclUnixFile.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 38504d9..2cb0027 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -1105,6 +1105,12 @@ TclNativeCreateNativeRep( str = Tcl_GetStringFromObj(validPathPtr, &len); Tcl_UtfToExternalDString(NULL, str, len, &ds); len = Tcl_DStringLength(&ds) + sizeof(char); + if (strlen(Tcl_DStringValue(&ds)) < len - sizeof(char)) { + /* See bug [3118489]: NUL in filenames */ + Tcl_DecrRefCount(validPathPtr); + Tcl_DStringFree(&ds); + return NULL; + } Tcl_DecrRefCount(validPathPtr); nativePathPtr = ckalloc(len); memcpy(nativePathPtr, Tcl_DStringValue(&ds), (size_t) len); @@ -1181,9 +1187,10 @@ TclpUtime( int TclOSstat( const char *name, - Tcl_StatBuf *statBuf) + void *cygstat) { struct stat buf; + Tcl_StatBuf *statBuf = cygstat; int result = stat(name, &buf); statBuf->st_mode = buf.st_mode; @@ -1203,9 +1210,10 @@ TclOSstat( int TclOSlstat( const char *name, - Tcl_StatBuf *statBuf) + void *cygstat) { struct stat buf; + Tcl_StatBuf *statBuf = cygstat; int result = lstat(name, &buf); statBuf->st_mode = buf.st_mode; |
