From: Gary Lockyer Date: Wed, 8 Apr 2026 21:34:04 +0000 (+1200) Subject: s4:libcli:resolve:dns_ex fix cast-align warning X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=905bb592240664c6ecf74a72db325a007d07df7b;p=thirdparty%2Fsamba.git s4:libcli:resolve:dns_ex fix cast-align warning rr->data is allocated via talloc in dns_unmarshal_rr so it will be correctly aligned Signed-off-by: Gary Lockyer Reviewed-by: Jennifer Sutton --- diff --git a/source4/libcli/resolve/dns_ex.c b/source4/libcli/resolve/dns_ex.c index 09cc10064dc..822fc456847 100644 --- a/source4/libcli/resolve/dns_ex.c +++ b/source4/libcli/resolve/dns_ex.c @@ -123,18 +123,30 @@ static int reply_to_addrs(TALLOC_CTX *mem_ctx, uint32_t *a_num, /* we are only interested in A and AAAA records */ switch (rr->type) { case QTYPE_A: + /* + * rr->data will be correctly aligned as it's allocated + * in dns_unmarshall_rr + */ addr = inet_ntop(AF_INET, - (struct in_addr *)rr->data, - addrstr, sizeof(addrstr)); + discard_align_p(struct in_addr, + rr->data), + addrstr, + sizeof(addrstr)); if (addr == NULL) { continue; } break; case QTYPE_AAAA: #ifdef HAVE_IPV6 + /* + * rr->data will be correctly aligned as it's allocated + * in dns_unmarshal_rr + */ addr = inet_ntop(AF_INET6, - (struct in6_addr *)rr->data, - addrstr, sizeof(addrstr)); + discard_align_p(struct in6_addr, + rr->data), + addrstr, + sizeof(addrstr)); #else addr = NULL; #endif