From 909c56c60412c6116139644474ed6aa4b00919a8 Mon Sep 17 00:00:00 2001 From: Brad House Date: Mon, 29 Apr 2024 14:48:53 -0400 Subject: [PATCH] fix endianness from PR #750 --- src/lib/ares_sysconfig_mac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/ares_sysconfig_mac.c b/src/lib/ares_sysconfig_mac.c index e7b3bf21..a3b0110d 100644 --- a/src/lib/ares_sysconfig_mac.c +++ b/src/lib/ares_sysconfig_mac.c @@ -240,13 +240,13 @@ static ares_status_t read_resolver(const dns_resolver_t *resolver, (struct sockaddr_in *)(void *)resolver->nameserver[i]; addr.family = AF_INET; memcpy(&addr.addr.addr4, &(addr_in->sin_addr), sizeof(addr.addr.addr4)); - addrport = addr_in->sin_port; + addrport = ntohs(addr_in->sin_port); } else if (resolver->nameserver[i]->sa_family == AF_INET6) { struct sockaddr_in6 *addr_in6 = (struct sockaddr_in6 *)(void *)resolver->nameserver[i]; addr.family = AF_INET6; memcpy(&addr.addr.addr6, &(addr_in6->sin6_addr), sizeof(addr.addr.addr6)); - addrport = addr_in6->sin6_port; + addrport = ntohs(addr_in6->sin6_port); } else { continue; }