This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Make padding in struct sockaddr_storage explicit [BZ #20111]
- From: Andreas Schwab <schwab at suse dot de>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 19 May 2016 17:18:13 +0200
- Subject: Re: [PATCH] Make padding in struct sockaddr_storage explicit [BZ #20111]
- Authentication-results: sourceware.org; auth=none
- References: <20160519131238 dot 1C38540113D03 at oldenburg dot str dot redhat dot com> <mvm60ua5fpa dot fsf at hawking dot suse dot de> <ba52d849-7100-ffbb-0319-8844a31e11b3 at redhat dot com>
Florian Weimer <fweimer@redhat.com> writes:
> What if we put the padding in the middle, like this?
>
> #define _SS_PADSIZE \
> _SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)
That is different from the current definition, potentially increasing
the size of the structure. The problem with the current definition is
that it assumes that offsetof (struct sockaddr_storage, __ss_align) ==
sizeof (__ss_aligntype), which is not guaranteed.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."