diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | unix/tclUnixPipe.c | 2 | ||||
-rw-r--r-- | win/tclWinPipe.c | 4 |
3 files changed, 9 insertions, 2 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-07-03 Donal K. Fellows <dkf@users.sf.net> * generic/tclUtil.c (TclDStringAppendObj, TclDStringAppendDString): diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index d01624c..a505bef 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -211,7 +211,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 65d4d06..cc696a2 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -676,6 +676,7 @@ TclpCreateTempFile( if (contents != NULL) { DWORD result, length; const char *p; + int toCopy; /* * Convert the contents from UTF to native encoding @@ -683,7 +684,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) { |