summaryrefslogtreecommitdiffstats
path: root/generic/tclProc.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/tclProc.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/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')