summaryrefslogtreecommitdiff
path: root/src/spellfile.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-02-01 13:11:15 +0000
committerBram Moolenaar <Bram@vim.org>2023-02-01 13:11:15 +0000
commit1b438a8228a415720efb5ca1c0503f5467292e8e (patch)
treec0594ccd7e5f15daebb599474a87d5cd394a2652 /src/spellfile.c
parenta7d36b732070944aab614944075ec0b409311482 (diff)
downloadvim-git-1b438a8228a415720efb5ca1c0503f5467292e8e.tar.gz
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/spellfile.c')
-rw-r--r--src/spellfile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/spellfile.c b/src/spellfile.c
index 710e4388f..bf51f5fd6 100644
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -4305,7 +4305,7 @@ getroom(
bl = NULL;
else
// Allocate a block of memory. It is not freed until much later.
- bl = alloc_clear(sizeof(sblock_T) + SBLOCKSIZE);
+ bl = alloc_clear(offsetof(sblock_T, sb_data) + SBLOCKSIZE + 1);
if (bl == NULL)
{
if (!spin->si_did_emsg)