On Wed, Nov 04, 2026 at 03:56:14AM -0600, Theo de Raadt wrote:
> Andrew Hewus Fresh <[email protected]> wrote:
>
> > #0 0x00000000ad4538b4 in gethostnamadr_async_run (as=Variable "as" is not
> > available.)
> > at /usr/src/lib/libc/asr/gethostnamadr_async.c:695
> > 695 na = n->aliases;
>
> gdb is not being very precise. This fault happens on all strict
> alignment architectures. If it suceeds, it is still wrong. The IP
> address being provided since the hostname/netname conversion by schwarze
> in 2018 has been is a pointer value not the correct result.
>
> h_addr is the actual IP address value, and the (struct in_addr *) cast
> trying to make it a pointer is wrong. I took an easy way out. I added
> internal printf's temporarily to verify that n_net is set to the correct
> host-order address.
This patch does make the Bus error go away.
> Index: gethostnamadr_async.c
> ===================================================================
> RCS file: /cvs/src/lib/libc/asr/gethostnamadr_async.c,v
> diff -u -p -u -r1.55 gethostnamadr_async.c
> --- gethostnamadr_async.c 21 Jul 2026 09:50:31 -0000 1.55
> +++ gethostnamadr_async.c 4 Nov 2026 09:42:41 -0000
> @@ -672,7 +672,7 @@ hostent_add_addr(struct hostent_ext *h,
> static void
> netent_from_hostent(struct asr_result *ar)
> {
> - struct in_addr *addr;
> + struct in_addr addr;
> struct netent_ext *n;
> struct hostent_ext *h;
> char **na, **ha;
> @@ -691,8 +691,8 @@ netent_from_hostent(struct asr_result *a
>
> /* Copy the fixed-size data. */
> h = (struct hostent_ext *)ar->ar_hostent;
> - addr = (struct in_addr *)h->h.h_addr;
> - n->n.n_net = ntohl(addr->s_addr);
> + memcpy(&addr, h->h.h_addr, sizeof addr);
> + n->n.n_net = ntohl(addr.s_addr);
> n->n.n_addrtype = h->h.h_addrtype;
>
> /* Copy the network name. */
>
--
andrew
If I'm ignoring you, it's not you, it's your question...
-- @RahulSood