From b40daa2c5b1708f23f07a083e7aa9f9c2b0de93f Mon Sep 17 00:00:00 2001 From: Brad House Date: Tue, 28 May 2024 14:51:34 -0400 Subject: [PATCH] MacOS UBSAN: another workaround --- src/lib/ares_sysconfig_mac.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/ares_sysconfig_mac.c b/src/lib/ares_sysconfig_mac.c index e19ab49e..421ae3a6 100644 --- a/src/lib/ares_sysconfig_mac.c +++ b/src/lib/ares_sysconfig_mac.c @@ -275,7 +275,12 @@ static ares_status_t read_resolvers(dns_resolver_t **resolvers, int nresolvers, for (i = 0; status == ARES_SUCCESS && i < nresolvers; i++) { const dns_resolver_t *resolver; - resolver = resolvers[i]; + /* UBSAN doesn't like that this is unaligned, lets use memcpy to get the + * address, same as: + * resolver = resolvers[i] + */ + memcpy(&resolver, resolvers + i, sizeof(resolver)); + status = read_resolver(resolver, sysconfig); }