diff options
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 b1affe3..0ef8d19 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -685,6 +685,7 @@ TclpCreateTempFile( if (contents != NULL) { DWORD result, length; const char *p; + int toCopy; /* * Convert the contents from UTF to native encoding @@ -692,7 +693,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) { |