summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclUtil.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 02a9a19..1cea3be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-01 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tclUtil.c: fix for [Bug 3309871]: Valgrind finds:
+ invalid read in TclMaxListLength()
+
2011-05-31 Don Porter <dgp@users.sourceforge.net>
* generic/tclInt.h: Use a complete growth algorithm for lists
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index ce66096..f424381 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -408,8 +408,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 */