Use tor_strdup() in place of malloc+strncpy+terminate.

This commit is contained in:
Nick Mathewson 2018-12-01 20:46:06 -05:00
parent 8accf71c44
commit 0015d00842

View File

@ -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);