[PATCH libX11] Use flexible array member instead of fake size.
Keith Packard
keithp at keithp.com
Thu Mar 15 18:33:56 UTC 2018
Michal Srb <msrb at suse.com> writes:
> The _XimCacheStruct structure is followed in memory by two strings containing
> fname and encoding. The memory was accessed using the last member of the
> structure `char fname[1]`. That is a lie, prohibits us from using sizeof and
> confuses checkers. Lets declare it properly as a flexible array, so compilers
> don't complain about writing past that array. As bonus we can replace the
> XOffsetOf with regular sizeof.
Thanks; this form is how we used to need to do this as C compilers
didn't support a flexible array at the end of a struct...
Reviewed-by: Keith Packard <keithp at keithp.com>
--
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20180315/5f2c82f2/attachment.sig>
More information about the xorg-devel
mailing list