From 9e3b04a564a6a212a33a2f2c85b706ffd9a1d1ee Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 3 May 2021 19:36:22 +0000 Subject: [PATCH] Fix [24b9181478]: Fix unsafe buffer lifetime --- generic/tclIO.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 4d3df65260d7..807fce13ccec 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -3813,6 +3813,7 @@ Write( /* State info for channel */ char *nextNewLine = NULL; int endEncoding, saved = 0, total = 0, flushed = 0, needNlFlush = 0; + char safe[BUFFER_PADDING]; if (srcLen) { WillWrite(chanPtr); @@ -3831,7 +3832,7 @@ Write( while (srcLen + saved + endEncoding > 0) { ChannelBuffer *bufPtr; - char *dst, safe[BUFFER_PADDING]; + char *dst; int result, srcRead, dstLen, dstWrote, srcLimit = srcLen; if (nextNewLine) {