From d4e9450bad5ee59d2d665bf403ab8c2b074808ab Mon Sep 17 00:00:00 2001 From: PahaKush <38435295+PahaKush@users.noreply.github.com> Date: Fri, 26 Jun 2026 20:48:47 +0900 Subject: [PATCH] fix(connector/relay): handle empty address in bind to fix UDP ASSOCIATE Fixes a bug where an empty bind address (as in SOCKS5 UDP ASSOCIATE) bypassed the SplitHostPort guard and passed `""` to `AddrFeature.ParseFrom`, which returns an error for empty hosts. Default to `0.0.0.0:0` (any address, any port) when address is empty. --- connector/relay/bind.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/connector/relay/bind.go b/connector/relay/bind.go index 33c04c13..79bfcf29 100644 --- a/connector/relay/bind.go +++ b/connector/relay/bind.go @@ -106,9 +106,11 @@ func (c *relayConnector) bind(conn net.Conn, cmd relay.CmdType, network, address }) fa := &relay.AddrFeature{} if network != "unix" { - if h, _, e := net.SplitHostPort(address); e == nil && h == "" { - address = net.JoinHostPort("0.0.0.0", address) - } + if address == "" { + address = "0.0.0.0:0" + } else if h, _, e := net.SplitHostPort(address); e == nil && h == "" { + address = net.JoinHostPort("0.0.0.0", address) + } } fa.ParseFrom(address) req.Features = append(req.Features, fa)