summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-07-05 13:56:00 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-07-05 13:56:00 (GMT)
commita54ec2aacbcefc9937f752af4178841cc53e9d25 (patch)
tree0367da0ef2ac5fe159aea82f6775995b75c7a54d
parent36245ad98788adfc0a8906fdd9c61ac0b82990b4 (diff)
parent8c652eebaacd8ebb77c256428a3cda8a1bf8b814 (diff)
downloadtcl-a54ec2aacbcefc9937f752af4178841cc53e9d25.zip
tcl-a54ec2aacbcefc9937f752af4178841cc53e9d25.tar.gz
tcl-a54ec2aacbcefc9937f752af4178841cc53e9d25.tar.bz2
1189293 Make "<<" binary safe.
-rw-r--r--ChangeLog5
-rw-r--r--unix/tclUnixPipe.c2
-rw-r--r--win/tclWinPipe.c4
3 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d1a2d6a..72c588d 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-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) {