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: fweimer at redhat dot com (Florian Weimer)
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 19 May 2016 15:40:17 +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>
fweimer@redhat.com (Florian Weimer) writes:
> diff --git a/bits/socket.h b/bits/socket.h
> index ab9f242..b3f2753 100644
> --- a/bits/socket.h
> +++ b/bits/socket.h
> @@ -164,6 +164,7 @@ struct sockaddr
> struct sockaddr_storage
> {
> __SOCKADDR_COMMON (ss_); /* Address family, etc. */
> + char __ss_padding_init[sizeof (__ss_aligntype) - __SOCKADDR_COMMON_SIZE];
That needs to be __alignof, otherwise you change the layout, and you
need to watch out for zero padding.
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."