The flexmember module provides the macro FLEXSIZEOF to calculate an appropriate size to malloc a struct with a flexible array member.
Overflow is reported differently than with the xsize module, which provides size_overflow_p. It would be great if the flexmember exported another macro, say XFLEXSIZEOF, which returned SIZE_MAX in case of arithmetic overflow. -- Marc