From 563978a3ea4e8b51fcf547298dfdafc516e04526 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Fri, 25 Jun 2021 02:55:22 +0100 Subject: [PATCH] socks4 upstream: add safety check for hostname length --- src/reqs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/reqs.c b/src/reqs.c index 9016051..03d2599 100644 --- a/src/reqs.c +++ b/src/reqs.c @@ -1263,6 +1263,8 @@ connect_to_upstream_proxy(struct conn_s *connptr, struct request_s *request) memcpy(&buff[4], "\0\0\0\1" /* socks4a fake ip */ "\0" /* user */, 5); len = strlen(request->host); + if(len>255) + return -1; memcpy(&buff[9], request->host, len+1); if (9+len+1 != safe_write(connptr->server_fd, buff, 9+len+1)) return -1;