summaryrefslogtreecommitdiffstats
path: root/generic/tkTextDisp.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-08 11:18:52 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-08 11:18:52 (GMT)
commit83920326ba5851cad594e6a261205a202b75a338 (patch)
tree02f945da86cca6f9173441bd599af6aa6fcd892b /generic/tkTextDisp.c
parentcfbabe08a1a584f554365f7387e6c7a59799e0c8 (diff)
downloadtk-83920326ba5851cad594e6a261205a202b75a338.zip
tk-83920326ba5851cad594e6a261205a202b75a338.tar.gz
tk-83920326ba5851cad594e6a261205a202b75a338.tar.bz2
Don't use sizeof(struct) when the structure has a char array as last element: If the size of this array changes, we'll be in trouble.
Diffstat (limited to 'generic/tkTextDisp.c')
-rw-r--r--generic/tkTextDisp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 371e910..03d11e1 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -7561,7 +7561,7 @@ TkTextCharLayoutProc(
ciPtr = &bciPtr->ci;
} else {
bciPtr = baseCharChunkPtr->clientData;
- ciPtr = ckalloc(sizeof(CharInfo));
+ ciPtr = ckalloc(Tk_Offset(CharInfo, chars) + 1);
baseString = &bciPtr->baseChars;
}