From b73d65ea904f50a5f00ccb3dff5fa66e515ca991 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Thu, 11 Sep 2025 13:54:17 +0200 Subject: [PATCH] socks4_connect(): Fix the dstsize passed to strlcpy() in case of socks4a Previously we would substract sizeof(struct socks_op) twice as it's already part of csiz. While this was wrong it didn't cause any actual problems as the buffer size is so large that it didn't matter. Reported by: Joshua Rogers --- gateway.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gateway.c b/gateway.c index 7b0412dd..fc712915 100644 --- a/gateway.c +++ b/gateway.c @@ -875,7 +875,7 @@ static jb_socket socks4_connect(const struct forward_spec *fwd, } else { - strlcpy(buf + csiz, target_host, sizeof(buf) - sizeof(struct socks_op) - csiz); + strlcpy(buf + csiz, target_host, sizeof(buf) - csiz); /* * What we forward to the socks4a server should have the * size of socks_op, plus the length of the userid plus -- 2.50.1