diff options
author | nijtmans <nijtmans> | 2011-01-25 15:55:48 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2011-01-25 15:55:48 (GMT) |
commit | 28a03ea31da5f07e45e7bcc19451d440856511ad (patch) | |
tree | 96fe18903ff9db6bec85728c33200aaca097c9bd /generic/tclCkalloc.c | |
parent | 3a9b9ebaa3ee461dcd89fc566e710d92305be0b8 (diff) | |
download | tcl-28a03ea31da5f07e45e7bcc19451d440856511ad.zip tcl-28a03ea31da5f07e45e7bcc19451d440856511ad.tar.gz tcl-28a03ea31da5f07e45e7bcc19451d440856511ad.tar.bz2 |
[Bug 3129448]: Possible over-allocation on 64-bit platforms, part 2,
backported strcpy->memcpy change but not change in any struct.
Diffstat (limited to 'generic/tclCkalloc.c')
-rw-r--r-- | generic/tclCkalloc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 27aad95..c7a9757 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -14,7 +14,7 @@ * * This code contributed by Karl Lehenbauer and Mark Diekhans * - * RCS: @(#) $Id: tclCkalloc.c,v 1.32.4.3 2010/10/02 00:29:42 hobbs Exp $ + * RCS: @(#) $Id: tclCkalloc.c,v 1.32.4.4 2011/01/25 15:55:48 nijtmans Exp $ */ #include "tclInt.h" @@ -824,6 +824,7 @@ MemoryCmd( FILE *fileP; Tcl_DString buffer; int result; + size_t len; if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -919,9 +920,10 @@ MemoryCmd( if ((curTagPtr != NULL) && (curTagPtr->refCount == 0)) { TclpFree((char *) curTagPtr); } - curTagPtr = (MemTag *) TclpAlloc(TAG_SIZE(strlen(argv[2]))); + len = strlen(argv[2]); + curTagPtr = (MemTag *) TclpAlloc(TAG_SIZE(len)); curTagPtr->refCount = 0; - strcpy(curTagPtr->string, argv[2]); + memcpy(curTagPtr->string, argv[2], len + 1); return TCL_OK; } if (strcmp(argv[1],"trace") == 0) { |