diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-05-08 11:18:52 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-05-08 11:18:52 (GMT) |
commit | 83920326ba5851cad594e6a261205a202b75a338 (patch) | |
tree | 02f945da86cca6f9173441bd599af6aa6fcd892b /generic/tkSelect.c | |
parent | cfbabe08a1a584f554365f7387e6c7a59799e0c8 (diff) | |
download | tk-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/tkSelect.c')
-rw-r--r-- | generic/tkSelect.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/generic/tkSelect.c b/generic/tkSelect.c index ab9018a..d763411 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -190,8 +190,8 @@ Tk_CreateSelHandler( * should make a copy for this selPtr. */ - unsigned cmdInfoLen = Tk_Offset(CommandInfo, command) + - ((CommandInfo *)clientData)->cmdLength + 1; + unsigned cmdInfoLen = Tk_Offset(CommandInfo, command) + 1 + + ((CommandInfo *)clientData)->cmdLength; selPtr->clientData = ckalloc(cmdInfoLen); memcpy(selPtr->clientData, clientData, cmdInfoLen); |