diff options
author | dgp <dgp@users.sourceforge.net> | 2015-07-17 21:22:22 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2015-07-17 21:22:22 (GMT) |
commit | 5234a59846f046760830b06488e2d214d0b2cf04 (patch) | |
tree | eb303b04e47fe05468dc5620171a0ee2c8453095 /unix/tclUnixFile.c | |
parent | 2fc3c8d6596a5d180b7f2c13451e8ec26144cb2b (diff) | |
parent | ad86656b196a9b34f2df43327c816d8099d7f3c8 (diff) | |
download | tcl-5234a59846f046760830b06488e2d214d0b2cf04.zip tcl-5234a59846f046760830b06488e2d214d0b2cf04.tar.gz tcl-5234a59846f046760830b06488e2d214d0b2cf04.tar.bz2 |
merge trunk
Diffstat (limited to 'unix/tclUnixFile.c')
-rw-r--r-- | unix/tclUnixFile.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 5bfe5d9..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); |