summaryrefslogtreecommitdiffstats
path: root/generic/tclParseExpr.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2003-02-16 01:36:32 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2003-02-16 01:36:32 (GMT)
commit23889e745ac1e3ba5e76c3ffb94736a5c475de7e (patch)
treeb9cac46b6b2fb5373a629e8d3758b7742b6a651c /generic/tclParseExpr.c
parentaf570109241e78092cb2e80486e479b3a71524ef (diff)
downloadtcl-23889e745ac1e3ba5e76c3ffb94736a5c475de7e.zip
tcl-23889e745ac1e3ba5e76c3ffb94736a5c475de7e.tar.gz
tcl-23889e745ac1e3ba5e76c3ffb94736a5c475de7e.tar.bz2
Don Porter's fix for bad parsing of nested scripts [Bug 681841].
Diffstat (limited to 'generic/tclParseExpr.c')
-rw-r--r--generic/tclParseExpr.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/generic/tclParseExpr.c b/generic/tclParseExpr.c
index 85be0cd..bb88159 100644
--- a/generic/tclParseExpr.c
+++ b/generic/tclParseExpr.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclParseExpr.c,v 1.16 2002/12/11 20:30:16 dgp Exp $
+ * RCS: @(#) $Id: tclParseExpr.c,v 1.17 2003/02/16 01:36:32 msofer Exp $
*/
#include "tclInt.h"
@@ -1287,10 +1287,23 @@ ParsePrimaryExpr(infoPtr)
return TCL_ERROR;
}
src = (nested.commandStart + nested.commandSize);
+
+ /*
+ * This is equivalent to Tcl_FreeParse(&nested), but
+ * presumably inlined here for sake of runtime optimization
+ */
+
if (nested.tokenPtr != nested.staticTokens) {
ckfree((char *) nested.tokenPtr);
}
- if ((src[-1] == ']') && !nested.incomplete) {
+
+ /*
+ * Check for the closing ']' that ends the command substitution.
+ * It must have been the last character of the parsed command.
+ */
+
+ if ((nested.term < parsePtr->end) && (*nested.term == ']')
+ && !nested.incomplete) {
break;
}
if (src == parsePtr->end) {