diff options
author | nijtmans <nijtmans@noemail.net> | 2010-12-06 09:01:49 (GMT) |
---|---|---|
committer | nijtmans <nijtmans@noemail.net> | 2010-12-06 09:01:49 (GMT) |
commit | 38feb52c3565d4b5212d5bf817f02fb7303d845a (patch) | |
tree | 82897612b5989945d086ccb23f71868fe1a656f6 /generic/tclCkalloc.c | |
parent | d491e09516e5d6d027863a054d5f3c717d57d433 (diff) | |
download | tcl-38feb52c3565d4b5212d5bf817f02fb7303d845a.zip tcl-38feb52c3565d4b5212d5bf817f02fb7303d845a.tar.gz tcl-38feb52c3565d4b5212d5bf817f02fb7303d845a.tar.bz2 |
[Bug 3129448]: possible over-allocation on 64-bit platforms
FossilOrigin-Name: ea6a3428d61672e2202ae2843bbdc45ab0846888
Diffstat (limited to 'generic/tclCkalloc.c')
-rw-r--r-- | generic/tclCkalloc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index dbd999e..4314554 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.41 2010/12/01 10:43:36 nijtmans Exp $ + * RCS: @(#) $Id: tclCkalloc.c,v 1.42 2010/12/06 09:01:49 nijtmans Exp $ */ #include "tclInt.h" @@ -32,12 +32,12 @@ typedef struct MemTag { int refCount; /* Number of mem_headers referencing this * tag. */ - char string[4]; /* Actual size of string will be as large as + char string[1]; /* Actual size of string will be as large as * needed for actual tag. This must be the * last field in the structure. */ } MemTag; -#define TAG_SIZE(bytesInString) ((unsigned) sizeof(MemTag) + bytesInString - 3) +#define TAG_SIZE(bytesInString) ((unsigned) ((TclOffset(MemTag, string) + 1) + bytesInString)) static MemTag *curTagPtr = NULL;/* Tag to use in all future mem_headers (set * by "memory tag" command). */ @@ -185,7 +185,7 @@ TclDumpMemoryInfo(ClientData clientData, int flags) maximum_malloc_packets, maximum_bytes_malloced); if (flags == 0) { - fprintf((FILE *)clientData, buf); + fprintf((FILE *)clientData, "%s", buf); } else { /* Assume objPtr to append to */ Tcl_AppendToObj((Tcl_Obj *) clientData, buf, -1); |