forked from aniani/vim
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)
This commit is contained in:
@@ -3228,7 +3228,7 @@ add_sound_suggest(
|
||||
hi = hash_lookup(&slang->sl_sounddone, goodword, hash);
|
||||
if (HASHITEM_EMPTY(hi))
|
||||
{
|
||||
sft = alloc(sizeof(sftword_T) + STRLEN(goodword));
|
||||
sft = alloc(offsetof(sftword_T, sft_word) + STRLEN(goodword) + 1);
|
||||
if (sft != NULL)
|
||||
{
|
||||
sft->sft_score = score;
|
||||
|
||||
Reference in New Issue
Block a user