diff options
author | stanton <stanton> | 1999-05-04 01:32:12 (GMT) |
---|---|---|
committer | stanton <stanton> | 1999-05-04 01:32:12 (GMT) |
commit | 1b188bce8407ab0d9d83e72177b9fada135782d2 (patch) | |
tree | c2e26071f5f28f667aa099e88f2dcf8fc1ebf9f6 /generic | |
parent | 119e9038ea1b3e2fc6e903045dedabf49c6facc0 (diff) | |
download | tcl-1b188bce8407ab0d9d83e72177b9fada135782d2.zip tcl-1b188bce8407ab0d9d83e72177b9fada135782d2.tar.gz tcl-1b188bce8407ab0d9d83e72177b9fada135782d2.tar.bz2 |
* generic/tclParse.c (Tcl_ParseCommand): Changed to avoid
modifying eval'ed strings that are already null terminated.
[Bug: 1793]
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclParse.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c index 647965a..4f35468 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclParse.c,v 1.6 1999/04/30 22:45:02 stanton Exp $ + * RCS: @(#) $Id: tclParse.c,v 1.7 1999/05/04 01:32:12 stanton Exp $ */ #include "tclInt.h" @@ -278,7 +278,9 @@ Tcl_ParseCommand(interp, string, numBytes, nested, parsePtr) */ savedChar = string[numBytes]; - string[numBytes] = 0; + if (savedChar != 0) { + string[numBytes] = 0; + } /* * Parse any leading space and comments before the first word of the @@ -478,11 +480,15 @@ Tcl_ParseCommand(interp, string, numBytes, nested, parsePtr) parsePtr->commandSize = src - parsePtr->commandStart; - string[numBytes] = (char) savedChar; + if (savedChar != 0) { + string[numBytes] = (char) savedChar; + } return TCL_OK; error: - string[numBytes] = (char) savedChar; + if (savedChar != 0) { + string[numBytes] = (char) savedChar; + } Tcl_FreeParse(parsePtr); if (parsePtr->commandStart == NULL) { parsePtr->commandStart = string; |