Merge branch 'maint-0.2.9' into release-0.2.9

This commit is contained in:
Nick Mathewson 2017-02-07 09:27:49 -05:00
commit 1ed6cb0deb
2 changed files with 9 additions and 0 deletions

5
changes/bug21280 Normal file
View File

@ -0,0 +1,5 @@
o Minor bugfixes (tor-resolve):
- The tor-resolve command line tool now rejects hostnames over 255
characters in length. Previously, it would silently truncate
them, which could lead to bugs. Fixes bug 21280; bugfix on 0.0.9pre5.
Patch by "junglefowl".

View File

@ -80,6 +80,10 @@ build_socks_resolve_request(char **out,
}
ipv6 = reverse && tor_addr_family(&addr) == AF_INET6;
addrlen = reverse ? (ipv6 ? 16 : 4) : 1 + strlen(hostname);
if (addrlen > UINT8_MAX) {
log_err(LD_GENERAL, "Hostname is too long!");
return -1;
}
len = 6 + addrlen;
*out = tor_malloc(len);
(*out)[0] = 5; /* SOCKS version 5 */