diff options
author | nijtmans <nijtmans> | 2011-01-25 15:55:48 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2011-01-25 15:55:48 (GMT) |
commit | 53b9e2937065442dd2431deb31a3dd31d0b5d81b (patch) | |
tree | 96fe18903ff9db6bec85728c33200aaca097c9bd /generic/tclCkalloc.c | |
parent | 846cac3a5896e94923fee07d2004efec4f73effc (diff) | |
download | tcl-53b9e2937065442dd2431deb31a3dd31d0b5d81b.zip tcl-53b9e2937065442dd2431deb31a3dd31d0b5d81b.tar.gz tcl-53b9e2937065442dd2431deb31a3dd31d0b5d81b.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) { |