aboutsummaryrefslogtreecommitdiff
path: root/src/tools/tor-resolve.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/tor-resolve.c')
-rw-r--r--src/tools/tor-resolve.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tools/tor-resolve.c b/src/tools/tor-resolve.c
index 29f85c4d17..6ac866d3c0 100644
--- a/src/tools/tor-resolve.c
+++ b/src/tools/tor-resolve.c
@@ -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 */