commit | 1b438a8228a415720efb5ca1c0503f5467292e8e | [log] [tgz] |
---|---|---|
author | zeertzjq <zeertzjq@outlook.com> | Wed Feb 01 13:11:15 2023 +0000 |
committer | Bram Moolenaar <Bram@vim.org> | Wed Feb 01 13:11:15 2023 +0000 |
tree | c0594ccd7e5f15daebb599474a87d5cd394a2652 | |
parent | a7d36b732070944aab614944075ec0b409311482 [diff] [blame] |
patch 9.0.1271: using sizeof() and subtract array size is tricky Problem: Using sizeof() and subtract array size is tricky. Solution: Use offsetof() instead. (closes #11926)
diff --git a/src/message.c b/src/message.c index d7b9263..b8e5eb9 100644 --- a/src/message.c +++ b/src/message.c
@@ -2739,7 +2739,7 @@ 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;