aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-07-26 15:42:10 +0200
committerNick Mathewson <nickm@torproject.org>2013-07-26 15:42:10 +0200
commit221a0159b81707f7cfcb3ec34c21830e9ce8aca5 (patch)
tree00876b8efe9f583db2c6cfe22dc6f0f3d1e288c8
parent5d4b5018be5d85162d96cc3781acbf892f33bc21 (diff)
parent8d0fb3a4347aa543d2aa27f177446888fbdae125 (diff)
downloadtor-221a0159b81707f7cfcb3ec34c21830e9ce8aca5.tar.gz
tor-221a0159b81707f7cfcb3ec34c21830e9ce8aca5.zip
Merge remote-tracking branch 'origin/maint-0.2.4'
-rw-r--r--changes/bug93374
-rw-r--r--src/or/dns.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/changes/bug9337 b/changes/bug9337
new file mode 100644
index 0000000000..ce99bc8184
--- /dev/null
+++ b/changes/bug9337
@@ -0,0 +1,4 @@
+ o Major bugfixes (DNS):
+ - Avoid an assertion failure when processing DNS replies without the
+ answer types we expected. Fixes bug 9337; bugfix on 0.2.4.7-alpha.
+
diff --git a/src/or/dns.c b/src/or/dns.c
index edcf92e5b3..f2b7eecc3f 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));