summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-07-02 16:22:18 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-07-02 16:22:18 (GMT)
commitff8f7134b39aa2fe4fe16fbda8ce58584f1dc645 (patch)
treea55b666665dee68835dc95f84554c3895f1cbcb2 /win
parentb3b04348558215a3acd092d58664c31a255781bf (diff)
downloadtcl-ff8f7134b39aa2fe4fe16fbda8ce58584f1dc645.zip
tcl-ff8f7134b39aa2fe4fe16fbda8ce58584f1dc645.tar.gz
tcl-ff8f7134b39aa2fe4fe16fbda8ce58584f1dc645.tar.bz2
1189293 Make '<<' redirects binary safe. Don't use strlen() (or equivalent)bug_1189293
to find end of written data bytes.
Diffstat (limited to 'win')
-rw-r--r--win/tclWinPipe.c4
1 files changed, 3 insertions, 1 deletions
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) {