diff options
author | dgp <dgp@users.sourceforge.net> | 2012-07-05 13:51:29 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-07-05 13:51:29 (GMT) |
commit | 8c652eebaacd8ebb77c256428a3cda8a1bf8b814 (patch) | |
tree | 1f7802c2615d135e2dcce19a4ea4daa61f172c0c | |
parent | b4acd4935320a64a571f6496290d44d1fafce047 (diff) | |
parent | 9792a27404caba808e5e0e5a15a6d86312613e4f (diff) | |
download | tcl-8c652eebaacd8ebb77c256428a3cda8a1bf8b814.zip tcl-8c652eebaacd8ebb77c256428a3cda8a1bf8b814.tar.gz tcl-8c652eebaacd8ebb77c256428a3cda8a1bf8b814.tar.bz2 |
1189293 Make "<<" binary safe.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | unix/tclUnixPipe.c | 2 | ||||
-rw-r--r-- | win/tclWinPipe.c | 4 |
3 files changed, 12 insertions, 5 deletions
@@ -1,3 +1,8 @@ +2012-07-05 Don Porter <dgp@users.sourceforge.net> + + * unix/tclUnixPipe.c: [Bug 1189293] Make "<<" binary safe. + * win/tclWinPipe.c: + 2012-06-29 Jan Nijtmans <nijtmans@users.sf.net> * library/msgcat/msgcat.tcl: Add tn, ro_MO and ru_MO to msgcat. @@ -109,9 +114,9 @@ 2012-05-21 Don Porter <dgp@users.sourceforge.net> - * generic/tclFileName.c: When using Tcl_SetObjLength() calls to grow - * generic/tclPathObj.c: and shrink the objPtr->bytes buffer, care must be - taken that the value cannot possibly become pure Unicode. Calling + * generic/tclFileName.c: When using Tcl_SetObjLength() calls to grow + * generic/tclIOUtil.c: and shrink the objPtr->bytes buffer, care must + be taken that the value cannot possibly become pure Unicode. Calling Tcl_AppendToObj() has the possibility of making such a conversion. Bug found while valgrinding the trunk. diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index eb3a218..105f032 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -212,7 +212,7 @@ TclpCreateTempFile( if (contents != NULL) { native = Tcl_UtfToExternalDString(NULL, contents, -1, &dstring); - if (write(fd, native, strlen(native)) == -1) { + if (write(fd, native, Tcl_DStringLength(&dstring)) == -1) { close(fd); Tcl_DStringFree(&dstring); return NULL; diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index b1affe3..0ef8d19 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -685,6 +685,7 @@ TclpCreateTempFile( if (contents != NULL) { DWORD result, length; const char *p; + int toCopy; /* * Convert the contents from UTF to native encoding @@ -692,7 +693,8 @@ TclpCreateTempFile( native = Tcl_UtfToExternalDString(NULL, contents, -1, &dstring); - for (p = native; *p != '\0'; p++) { + toCopy = Tcl_DStringLength(&dstring); + for (p = native; toCopy > 0; p++, toCopy--) { if (*p == '\n') { length = p - native; if (length > 0) { |