diff options
author | dgp <dgp@users.sourceforge.net> | 2012-07-02 16:22:18 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-07-02 16:22:18 (GMT) |
commit | 365f431b636ec6b553ea127587a92b9956003f0a (patch) | |
tree | a55b666665dee68835dc95f84554c3895f1cbcb2 /win/tclWinPipe.c | |
parent | eb57e9b4301023a8a734e2d802a7e2c1f122bce1 (diff) | |
download | tcl-365f431b636ec6b553ea127587a92b9956003f0a.zip tcl-365f431b636ec6b553ea127587a92b9956003f0a.tar.gz tcl-365f431b636ec6b553ea127587a92b9956003f0a.tar.bz2 |
1189293 Make '<<' redirects binary safe. Don't use strlen() (or equivalent)
to find end of written data bytes.
Diffstat (limited to 'win/tclWinPipe.c')
-rw-r--r-- | win/tclWinPipe.c | 4 |
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) { |