diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-02-01 13:11:15 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-02-01 13:11:15 +0000 |
commit | 1b438a8228a415720efb5ca1c0503f5467292e8e (patch) | |
tree | c0594ccd7e5f15daebb599474a87d5cd394a2652 /src/message.c | |
parent | a7d36b732070944aab614944075ec0b409311482 (diff) |
patch 9.0.1271: using sizeof() and subtract array size is trickyv9.0.1271
Problem: Using sizeof() and subtract array size is tricky.
Solution: Use offsetof() instead. (closes #11926)
Diffstat (limited to 'src/message.c')
-rw-r--r-- | src/message.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/message.c b/src/message.c index d7b9263571..b8e5eb95f2 100644 --- a/src/message.c +++ b/src/message.c @@ -2739,7 +2739,7 @@ store_sb_text( if (s > *sb_str) { - mp = alloc(sizeof(msgchunk_T) + (s - *sb_str)); + mp = alloc(offsetof(msgchunk_T, sb_text) + (s - *sb_str) + 1); if (mp != NULL) { mp->sb_eol = finish; |