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/findfile.c b/src/findfile.c
index 4e2ad77..e0d9d66 100644
--- a/src/findfile.c
+++ b/src/findfile.c
@@ -1344,7 +1344,8 @@
/*
* 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;