[PATCH] Fix strict-aliasing warning in resolv/res_hconf.c
Florian Weimer
fweimer@redhat.com
Wed May 27 13:36:00 GMT 2015
On 05/27/2015 11:19 AM, Pedro Alves wrote:
> Without adding a new union member, isn't the simplest to just take a
> copy step? The interface already clearly assumes that a sockaddr_in
> fits in a sockaddr. Something like:
>
> union
> {
> struct sockaddr sa;
> struct sockaddr_in sin;
> } ss;
>
> - ifaddrs[new_num_ifs].u.ipv4.addr =
> - ((struct sockaddr_in *) &cur_ifr->ifr_addr)->sin_addr.s_addr;
> + ss.sa = cur_ifr->ifr_addr;
> + ifaddrs[new_num_ifs].u.ipv4.addr = ss.sin.sin_addr.s_addr;
>
> etc.
I misread this proposal. I now think this is a possible fix, and a very
conservative one at that.
--
Florian Weimer / Red Hat Product Security
More information about the Libc-alpha
mailing list