Add missing check for hostname answer_len in dnsserv size

This is checked elsewhere too, but let's be RFC-conformant.
This commit is contained in:
Nick Mathewson 2011-01-15 13:09:12 -05:00
parent c2aa2db8b5
commit 31b562e10a

View File

@ -271,6 +271,7 @@ dnsserv_resolved(edge_connection_t *conn,
name, name,
1, (char*)answer, ttl); 1, (char*)answer, ttl);
} else if (answer_type == RESOLVED_TYPE_HOSTNAME && } else if (answer_type == RESOLVED_TYPE_HOSTNAME &&
answer_len < 256 &&
conn->socks_request->command == SOCKS_COMMAND_RESOLVE_PTR) { conn->socks_request->command == SOCKS_COMMAND_RESOLVE_PTR) {
char *ans = tor_strndup(answer, answer_len); char *ans = tor_strndup(answer, answer_len);
evdns_server_request_add_ptr_reply(req, NULL, evdns_server_request_add_ptr_reply(req, NULL,