aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-07-10 18:38:57 +0000
committerNick Mathewson <nickm@torproject.org>2006-07-10 18:38:57 +0000
commit39344fc301b9f42358bd7874a0d467ff4d5a0e96 (patch)
tree90901599e43f12fd19cc715d5a244ac5d2c20935 /src/or
parentd5d7f8e62cb47be85908c23877d77a2d736752f6 (diff)
downloadtor-39344fc301b9f42358bd7874a0d467ff4d5a0e96.tar
tor-39344fc301b9f42358bd7874a0d467ff4d5a0e96.tar.gz
Add a const; fix a (probably harmless) bug when storing a resolve we forgot we asked for.
svn:r6751
Diffstat (limited to 'src/or')
-rw-r--r--src/or/dns.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index 123c10ef1..0e13270f5 100644
--- a/src/or/dns.c
+++ b/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;