diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-12-01 20:46:06 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-12-01 20:46:06 -0500 |
commit | 0015d0084262ddc60098b15d6cdf30ea66d59a53 (patch) | |
tree | 5ce5e1777f6e0a4f46628763aecd7bd55a4b05eb /src/tools | |
parent | 8accf71c4418990296dbc01ffa4020da10448a7d (diff) | |
download | tor-0015d0084262ddc60098b15d6cdf30ea66d59a53.tar.gz tor-0015d0084262ddc60098b15d6cdf30ea66d59a53.zip |
Use tor_strdup() in place of malloc+strncpy+terminate.
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/tor-resolve.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/tools/tor-resolve.c b/src/tools/tor-resolve.c index ba83f3e3b4..803ed26b3b 100644 --- a/src/tools/tor-resolve.c +++ b/src/tools/tor-resolve.c @@ -512,14 +512,7 @@ do_resolve(const char *hostname, domainname_t *dn = socks5_server_reply_get_bind_addr_domainname(reply); - size_t result_len = (size_t)domainname_get_len(dn); - - *result_hostname = tor_malloc(result_len+1); - - strncpy(*result_hostname, (char *)domainname_getstr_name(dn), - result_len); - - (*result_hostname)[result_len] = '\0'; + *result_hostname = tor_strdup(domainname_getstr_name(dn)); } socks5_server_reply_free(reply); |