diff options
author | nijtmans <nijtmans> | 2010-12-06 09:01:49 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-12-06 09:01:49 (GMT) |
commit | 5686ea4acac17705c9704829c24608749acd3d12 (patch) | |
tree | 82897612b5989945d086ccb23f71868fe1a656f6 /generic/tclCkalloc.c | |
parent | 3a3eeca75b5436a7b68e1464811bdc3528d20cf0 (diff) | |
download | tcl-5686ea4acac17705c9704829c24608749acd3d12.zip tcl-5686ea4acac17705c9704829c24608749acd3d12.tar.gz tcl-5686ea4acac17705c9704829c24608749acd3d12.tar.bz2 |
[Bug 3129448]: possible over-allocation on 64-bit platforms
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); |