From 4f7a611cbe24c6a4f3249b7557fc600c4dd020a6 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Wed, 18 Nov 2026 21:37:29 +0300 Subject: [PATCH] socks: a SOCKS4a request is not a connect to the null address --- src/socks.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/socks.c b/src/socks.c index 1ad95cb..61f89b6 100644 --- a/src/socks.c +++ b/src/socks.c @@ -119,7 +119,10 @@ void * sockschild(struct clientparam* param) { } res = socks5_setaddr(param->srv->family, c, buf, ¶m->req); if(res == 1) {RETURN(997);} - if(res == 2 && command == 1) {RETURN(431);} + /* The null address is no destination to connect to, except in + SOCKS4a, where it says that the destination is the name which + follows it. */ + if(res == 2 && ver == 5 && command == 1) {RETURN(431);} param->sinsr = param->req; myinet_ntop(*SAFAMILY(¶m->sinsr), SAADDR(¶m->sinsr), (char *)buf, 64); break;