summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclVar.c13
2 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d8c9cf..6f7837f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2002-07-17 Miguel Sofer <msofer@users.sourceforge.net>
+ * generic/tclVar.c (DupParsedVarName): nasty bug fixed, reported
+ by Vince Darley.
+
+2002-07-17 Miguel Sofer <msofer@users.sourceforge.net>
+
* generic/tclVar.c (TclPtrIncrVar): missing CONST in declarations,
inconsistent with tclInt.h. Thanks to Vince Darley for reporting,
boo to gcc for not complaining.
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 2392961..cf45c5c 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclVar.c,v 1.59 2002/07/17 20:27:34 msofer Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.60 2002/07/17 20:42:27 msofer Exp $
*/
#include "tclInt.h"
@@ -5075,14 +5075,15 @@ DupParsedVarName(srcPtr, dupPtr)
if (arrayPtr != NULL) {
Tcl_IncrRefCount(arrayPtr);
+ elemLen = strlen(elem);
+ elemCopy = ckalloc(elemLen+1);
+ memcpy(elemCopy, elem, elemLen);
+ *(elemCopy + elemLen) = '\0';
+ elem = elemCopy;
}
- elemLen = strlen(elem);
- elemCopy = ckalloc(elemLen+1);
- memcpy(elemCopy, elem, elemLen);
- *(elemCopy + elemLen) = '\0';
dupPtr->internalRep.twoPtrValue.ptr1 = (VOID *) arrayPtr;
- dupPtr->internalRep.twoPtrValue.ptr2 = (VOID *) elemCopy;
+ dupPtr->internalRep.twoPtrValue.ptr2 = (VOID *) elem;
dupPtr->typePtr = &tclParsedVarNameType;
}