summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-09-26 22:03:23 +0000
committerNick Mathewson <nickm@torproject.org>2006-09-26 22:03:23 +0000
commitcd2425ffa0cd3308dedfd79bf574a115622e2574 (patch)
tree81333b18fbe29d363d0d17bdb8fb111c83c3ca87 /src/or
parent3994b02c0e53ba3bbf89a9a2770c22caa37f110e (diff)
downloadtor-cd2425ffa0cd3308dedfd79bf574a115622e2574.tar.gz
tor-cd2425ffa0cd3308dedfd79bf574a115622e2574.zip
r8968@Kushana: nickm | 2006-09-26 17:53:27 -0400
Fix for reverse dns: only assume we will get an answer when the result was success. svn:r8507
Diffstat (limited to 'src/or')
-rw-r--r--src/or/dns.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index f38b6fff09..1a955cd2aa 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -861,8 +861,13 @@ add_answer_to_cache(const char *address, int is_reverse, uint32_t addr,
strlcpy(resolve->address, address, sizeof(resolve->address));
resolve->is_reverse = is_reverse;
if (is_reverse) {
- tor_assert(hostname);
- resolve->result.hostname = tor_strdup(hostname);
+ if (outcome == DNS_RESOLVE_SUCCEEDED) {
+ tor_assert(hostname);
+ resolve->result.hostname = tor_strdup(hostname);
+ } else {
+ tor_assert(! hostname);
+ resolve->result.hostname = NULL;
+ }
} else {
tor_assert(!hostname);
resolve->result.addr = addr;