summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-07-05 13:50:20 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-07-05 13:50:20 (GMT)
commit9792a27404caba808e5e0e5a15a6d86312613e4f (patch)
tree52cc8997929607ada07915e227b75226c72d1ef9
parent65ec1ae3b83f27031adbc962765efdd11bdddeb2 (diff)
parentff8f7134b39aa2fe4fe16fbda8ce58584f1dc645 (diff)
downloadtcl-9792a27404caba808e5e0e5a15a6d86312613e4f.zip
tcl-9792a27404caba808e5e0e5a15a6d86312613e4f.tar.gz
tcl-9792a27404caba808e5e0e5a15a6d86312613e4f.tar.bz2
1189293 Make "<<" binary safe.
-rw-r--r--ChangeLog11
-rw-r--r--unix/tclUnixPipe.c2
-rw-r--r--win/tclWinPipe.c4
3 files changed, 12 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a2b3649..de29b61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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. Make it
@@ -56,9 +61,9 @@
2012-05-21 Don Porter <dgp@users.sourceforge.net>
- * 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
+ * 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 3a4005c..829a4a6 100644
--- a/unix/tclUnixPipe.c
+++ b/unix/tclUnixPipe.c
@@ -213,7 +213,7 @@ TclpCreateTempFile(contents)
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 4c530e3..3a55abb 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -691,13 +691,15 @@ TclpCreateTempFile(contents)
if (contents != NULL) {
DWORD result, length;
CONST char *p;
+ int toCopy;
/*
* Convert the contents from UTF to native encoding
*/
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) {