diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-01-11 14:13:13 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-01-11 14:13:13 +0000 |
commit | 3dfeaaaf6ef977bb833672c6cce15aa71838aae0 (patch) | |
tree | 985fb43083c19f76a2e7ec4f97acb5cc7f0cb24e /src/or/dns.c | |
parent | 0c77ae2fcbf3ff08270adfc0c44ffa0b2308c81c (diff) | |
download | tor-3dfeaaaf6ef977bb833672c6cce15aa71838aae0.tar tor-3dfeaaaf6ef977bb833672c6cce15aa71838aae0.tar.gz |
r11931@Kushana: nickm | 2007-01-11 09:12:49 -0500
Fix a crash bug in the presence of DNS hijacking.
svn:r9333
Diffstat (limited to 'src/or/dns.c')
-rw-r--r-- | src/or/dns.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index 09805e53e..d5f5ef582 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -1625,12 +1625,10 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses, status = DNS_RESOLVE_FAILED_TRANSIENT; } if (was_wildcarded) { - int is_test_addr = is_test_address(hostname); - - if (is_test_addr) { + if (is_test_address(string_address)) { /* Ick. We're getting redirected on known-good addresses. Our DNS * server must really hate us. */ - add_wildcarded_test_address(hostname); + add_wildcarded_test_address(string_address); } } if (result != DNS_ERR_SHUTDOWN) @@ -1744,16 +1742,19 @@ wildcard_increment_answer(const char *id) static void add_wildcarded_test_address(const char *address) { - int n; + int n, n_test_addrs; if (!dns_wildcarded_test_address_list) dns_wildcarded_test_address_list = smartlist_create(); if (smartlist_string_isin_case(dns_wildcarded_test_address_list, address)) return; + n_test_addrs = get_options()->ServerDNSTestAddresses ? + smartlist_len(get_options()->ServerDNSTestAddresses) : 0; + smartlist_add(dns_wildcarded_test_address_list, tor_strdup(address)); n = smartlist_len(dns_wildcarded_test_address_list); - if (n > smartlist_len(get_options()->ServerDNSTestAddresses)/2) { + if (n > n_test_addrs/2) { log(dns_wildcarded_test_address_notice_given ? LOG_INFO : LOG_NOTICE, LD_EXIT, "Your DNS provider tried to redirect \"%s\" to a junk " "address. It has done this with %d test addresses so far. I'm " |