From 1b188bce8407ab0d9d83e72177b9fada135782d2 Mon Sep 17 00:00:00 2001 From: stanton Date: Tue, 4 May 1999 01:32:12 +0000 Subject: * generic/tclParse.c (Tcl_ParseCommand): Changed to avoid modifying eval'ed strings that are already null terminated. [Bug: 1793] --- generic/tclParse.c | 14 ++++++++++---- 1 file 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; -- cgit v0.12