From ab1ff5f9d6a78c586f81d6c274544cb5b4c45b92 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 1 Jun 2011 12:06:54 +0000 Subject: fix for [Bug 3309871]: Valgrind finds: invalid read in TclMaxListLength() --- ChangeLog | 5 +++++ generic/tclUtil.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9fe71c5..78c78c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-06-01 Jan Nijtmans + + * generic/tclUtil.c: fix for [Bug 3309871]: Valgrind finds: + invalid read in TclMaxListLength() + 2011-05-25 Don Porter * library/msgcat/msgcat.tcl: Backport improvements to msgcat diff --git a/generic/tclUtil.c b/generic/tclUtil.c index b00489d..9a23291 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -409,8 +409,8 @@ TclMaxListLength( do { bytes++; numBytes -= (numBytes != -1); - } while (numBytes && TclIsSpaceProc(*bytes)); - if (numBytes == 0) { + } while (numBytes && (*bytes != '\0') && TclIsSpaceProc(*bytes)); + if ((numBytes == 0) || (*bytes == '\0')) { break; } /* (*bytes) is non-space; return to counting state */ -- cgit v0.12