diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-07-26 15:33:46 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-07-26 15:33:46 +0200 |
commit | 11f1b7d9dfa8434c629339220ed47f87a957344b (patch) | |
tree | ff5e3106eea633885c322111afd6b54f2f4993d2 /src/or | |
parent | 1d2e8020b7be5aff08cfde6f94c24b145625c1ad (diff) | |
download | tor-11f1b7d9dfa8434c629339220ed47f87a957344b.tar tor-11f1b7d9dfa8434c629339220ed47f87a957344b.tar.gz |
Avoid assertion failure on unexepcted address family in DNS reply.
Fixes bug 9337; bugfix on 0.2.4.7-alpha.
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/dns.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index edcf92e5b..f2b7eecc3 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -437,8 +437,8 @@ cached_resolve_add_answer(cached_resolve_t *resolve, if (resolve->res_status_ipv4 != RES_STATUS_INFLIGHT) return; - if (dns_result == DNS_ERR_NONE && answer_addr) { - tor_assert(tor_addr_family(answer_addr) == AF_INET); + if (dns_result == DNS_ERR_NONE && answer_addr && + tor_addr_family(answer_addr) == AF_INET) { resolve->result_ipv4.addr_ipv4 = tor_addr_to_ipv4h(answer_addr); resolve->res_status_ipv4 = RES_STATUS_DONE_OK; } else { @@ -450,8 +450,8 @@ cached_resolve_add_answer(cached_resolve_t *resolve, if (resolve->res_status_ipv6 != RES_STATUS_INFLIGHT) return; - if (dns_result == DNS_ERR_NONE && answer_addr) { - tor_assert(tor_addr_family(answer_addr) == AF_INET6); + if (dns_result == DNS_ERR_NONE && answer_addr && + tor_addr_family(answer_addr) == AF_INET6) { memcpy(&resolve->result_ipv6.addr_ipv6, tor_addr_to_in6(answer_addr), sizeof(struct in6_addr)); |