diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-07-10 18:38:57 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-07-10 18:38:57 +0000 |
commit | e43d857d434c7b2df7301b1cf6bb7a5f71bb61a6 (patch) | |
tree | 34bece88d089c0b8939fc77507273217458af5bf | |
parent | c2127d5fcb7fb87acf79fb382f1e7820b54254d0 (diff) | |
download | tor-e43d857d434c7b2df7301b1cf6bb7a5f71bb61a6.tar.gz tor-e43d857d434c7b2df7301b1cf6bb7a5f71bb61a6.zip |
Add a const; fix a (probably harmless) bug when storing a resolve we forgot we asked for.
svn:r6751
-rw-r--r-- | trunk/src/or/dns.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/trunk/src/or/dns.c b/trunk/src/or/dns.c index 123c10ef11..0e13270f5b 100644 --- a/trunk/src/or/dns.c +++ b/trunk/src/or/dns.c @@ -78,7 +78,7 @@ typedef struct cached_resolve_t { static void purge_expired_resolves(uint32_t now); static void dns_purge_resolve(cached_resolve_t *resolve); -static void dns_found_answer(char *address, uint32_t addr, char outcome, +static void dns_found_answer(const char *address, uint32_t addr, char outcome, uint32_t ttl); static void send_resolved_cell(connection_t *conn, uint8_t answer_type); static int assign_to_dnsworker(connection_t *exitconn); @@ -593,7 +593,7 @@ dns_purge_resolve(cached_resolve_t *resolve) * DNS_RESOLVE_{FAILED_TRANSIENT|FAILED_PERMANENT|SUCCEEDED}. */ static void -dns_found_answer(char *address, uint32_t addr, char outcome, uint32_t ttl) +dns_found_answer(const char *address, uint32_t addr, char outcome, uint32_t ttl) { pending_connection_t *pend; cached_resolve_t search; @@ -610,6 +610,7 @@ dns_found_answer(char *address, uint32_t addr, char outcome, uint32_t ttl) resolve = tor_malloc_zero(sizeof(cached_resolve_t)); resolve->state = (outcome == DNS_RESOLVE_SUCCEEDED) ? CACHE_STATE_VALID : CACHE_STATE_FAILED; + strlcpy(resolve->address, address, sizeof(resolve->address)); resolve->addr = addr; resolve->expire = time(NULL) + dns_get_expiry_ttl(ttl); resolve->ttl = ttl; |