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/findfile.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/findfile.c')
-rw-r--r-- | src/findfile.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/findfile.c b/src/findfile.c index 4e2ad774c6..e0d9d66382 100644 --- a/src/findfile.c +++ b/src/findfile.c @@ -1344,7 +1344,8 @@ ff_check_visited( /* * New file/dir. Add it to the list of visited files/dirs. */ - vp = alloc(sizeof(ff_visited_T) + STRLEN(ff_expand_buffer)); + vp = alloc( + offsetof(ff_visited_T, ffv_fname) + STRLEN(ff_expand_buffer) + 1); if (vp == NULL) return OK; |