https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101832

--- Comment #5 from Kees Cook <kees at outflux dot net> ---
Perhaps the best question to ask is "given an arbitrary argument, how can code
detect the remaining bytes of a member, including if the member contains a
flexible array?"

Because right now, this does not work:

#define __bytes_until_end_of_member(p) __builtin_object_size(p, 1)

since this gives different answers, depending on the level of dereference:

__bytes_until_end_of_member(wrap) == -1
__bytes_until_end_of_member(&wrap->msg) == 16
__bytes_until_end_of_member(&wrap->msg.nlmsg_content) == -1

How can "wrap->msg" be 16 if "wrap" and "warp->msg.nlmsg_content" are -1?

Reply via email to