diff options
author | nijtmans <nijtmans> | 2010-12-06 09:01:49 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-12-06 09:01:49 (GMT) |
commit | ada3e21ac86baba934efd6d7a2427855079c72ad (patch) | |
tree | 82897612b5989945d086ccb23f71868fe1a656f6 /generic/tclCkalloc.c | |
parent | 5beae862e19a2e7436529dc895052bc0b4364ad4 (diff) | |
download | tcl-ada3e21ac86baba934efd6d7a2427855079c72ad.zip tcl-ada3e21ac86baba934efd6d7a2427855079c72ad.tar.gz tcl-ada3e21ac86baba934efd6d7a2427855079c72ad.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); |