summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkSelect.c4
-rw-r--r--generic/tkTextDisp.c2
2 files changed, 3 insertions, 3 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);
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;
}