aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jim.c2
-rw-r--r--regtest.tcl5
2 files changed, 6 insertions, 1 deletions
diff --git a/jim.c b/jim.c
index 09396bd..d8e0d9c 100644
--- a/jim.c
+++ b/jim.c
@@ -10151,7 +10151,7 @@ static int JimParseSubstStr(struct JimParserCtx *pc)
{
pc->tstart = pc->p;
pc->tline = pc->linenr;
- while (*pc->p && *pc->p != '$' && *pc->p != '[') {
+ while (pc->len && *pc->p != '$' && *pc->p != '[') {
if (*pc->p == '\\' && pc->len > 1) {
pc->p++;
pc->len--;
diff --git a/regtest.tcl b/regtest.tcl
index 632df73..49a3d53 100644
--- a/regtest.tcl
+++ b/regtest.tcl
@@ -130,6 +130,11 @@ proc a {} { global ::blah; set ::blah test }
a
puts "TEST 20 PASSED"
+# REGTEST 21
+# 26 May 2011 - infinite loop with null byte in subst
+subst "abc\0def"
+puts "TEST 21 PASSED"
+
# TAKE THE FOLLOWING puts AS LAST LINE
puts "--- ALL TESTS PASSED ---"