summaryrefslogtreecommitdiffstats
path: root/generic/tclProc.c
diff options
context:
space:
mode:
authornijtmans <nijtmans@noemail.net>2010-12-10 21:59:22 (GMT)
committernijtmans <nijtmans@noemail.net>2010-12-10 21:59:22 (GMT)
commit6611242d2576ae12ed7693024aa5cf6da1bc5926 (patch)
treef5a596654db0ccc6fc206c51f688b6bd218ce97a /generic/tclProc.c
parentd6108b63f17b35327ea08d36a34681efec79bad5 (diff)
downloadtcl-6611242d2576ae12ed7693024aa5cf6da1bc5926.zip
tcl-6611242d2576ae12ed7693024aa5cf6da1bc5926.tar.gz
tcl-6611242d2576ae12ed7693024aa5cf6da1bc5926.tar.bz2
[Bug 3129448]: Possible over-allocation on 64-bit platforms, part 2
FossilOrigin-Name: e6ddd08613c8541a6cf7140ee21f67cef0244520
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r--generic/tclProc.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 315af88..bfc101c 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclProc.c,v 1.182 2010/09/27 19:42:38 msofer Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.183 2010/12/10 21:59:23 nijtmans Exp $
*/
#include "tclInt.h"
@@ -622,8 +622,7 @@ TclCreateProc(
*/
localPtr = (CompiledLocal *) ckalloc((unsigned)
- (sizeof(CompiledLocal) - sizeof(localPtr->name)
- + nameLength + 1));
+ (TclOffset(CompiledLocal, name) + nameLength + 1));
if (procPtr->firstLocalPtr == NULL) {
procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr;
} else {
@@ -643,7 +642,7 @@ TclCreateProc(
} else {
localPtr->defValuePtr = NULL;
}
- strcpy(localPtr->name, fieldValues[0]);
+ memcpy(localPtr->name, fieldValues[0], nameLength + 1);
if ((i == numArgs - 1)
&& (localPtr->nameLength == 4)
&& (localPtr->name[0] == 'a')