From: Jeremy Harris Date: Sun, 22 Nov 2015 00:29:16 +0000 (+0000) Subject: Fix potential misaligned ipv6 result records from DNS search X-Git-Tag: exim-4_87_RC1~31 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/d57d474fe88b3c9837f8516779c87f3a76f682f2?ds=sidebyside Fix potential misaligned ipv6 result records from DNS search --- diff --git a/src/src/dns.c b/src/src/dns.c index 27ab2d2a2..9859e8365 100644 --- a/src/src/dns.c +++ b/src/src/dns.c @@ -1112,8 +1112,7 @@ return DNS_FAIL; * Get address(es) from DNS record * *************************************************/ -/* The record type is either T_A for an IPv4 address or T_AAAA (or T_A6 when -supported) for an IPv6 address. +/* The record type is either T_A for an IPv4 address or T_AAAA for an IPv6 address. Argument: dnsa the DNS answer block @@ -1145,8 +1144,11 @@ else { if (rr->data + 16 <= dnsa_lim) { + struct in6_addr in6; + int i; + for (i = 0; i < 16; i++) in6.__in6_u.__u6_addr8[i] = rr->data[i]; yield = store_get(sizeof(dns_address) + 50); - inet_ntop(AF_INET6, US rr->data, CS yield->address, 50); + inet_ntop(AF_INET6, &in6, CS yield->address, 50); yield->next = NULL; } } diff --git a/src/src/host.c b/src/src/host.c index 67d33a9b8..4099a7506 100644 --- a/src/src/host.c +++ b/src/src/host.c @@ -2408,10 +2408,7 @@ for (; i >= 0; i--) { if (rr->type == type) { - /* dns_address *da = dns_address_from_rr(&dnsa, rr); */ - - dns_address *da; - da = dns_address_from_rr(&dnsa, rr); + dns_address *da = dns_address_from_rr(&dnsa, rr); DEBUG(D_host_lookup) if (!da) debug_printf("no addresses extracted from A6 RR for %s\n",