summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-12-10 21:59:23 (GMT)
committernijtmans <nijtmans>2010-12-10 21:59:23 (GMT)
commit8bfe2a72f81586691fd3ddf6ff8b40b74aeb312d (patch)
treef5a596654db0ccc6fc206c51f688b6bd218ce97a /generic/tclCompile.c
parentc62e68e149eae9355fd8af6bd73c7f50b291b9b8 (diff)
downloadtcl-8bfe2a72f81586691fd3ddf6ff8b40b74aeb312d.zip
tcl-8bfe2a72f81586691fd3ddf6ff8b40b74aeb312d.tar.gz
tcl-8bfe2a72f81586691fd3ddf6ff8b40b74aeb312d.tar.bz2
[Bug 3129448]: Possible over-allocation on 64-bit platforms, part 2
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index d40af69..96d9896 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompile.c,v 1.193 2010/10/20 20:52:27 ferrieux Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.194 2010/12/10 21:59:23 nijtmans Exp $
*/
#include "tclInt.h"
@@ -2600,8 +2600,7 @@ TclFindCompiledLocal(
if (create || (name == NULL)) {
localVar = procPtr->numCompiledLocals;
localPtr = (CompiledLocal *) ckalloc((unsigned)
- (sizeof(CompiledLocal) - sizeof(localPtr->name)
- + nameBytes + 1));
+ (TclOffset(CompiledLocal, name) + nameBytes + 1));
if (procPtr->firstLocalPtr == NULL) {
procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr;
} else {
@@ -4404,7 +4403,7 @@ static void UpdateStringOfInstName(Tcl_Obj *objPtr)
}
len = strlen(s);
objPtr->bytes = ckalloc((unsigned) len + 1);
- strcpy(objPtr->bytes, s);
+ memcpy(objPtr->bytes, s, len + 1);
objPtr->length = len;
}