From a008bc063fe87bde66b3023be54eb35d8bac3c90 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Wed, 3 Jun 2020 18:49:20 +0800 Subject: [PATCH] Fix: panic of socks5 client missing authentication --- component/socks5/socks5.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/component/socks5/socks5.go b/component/socks5/socks5.go index 6c58a848..2950819a 100644 --- a/component/socks5/socks5.go +++ b/component/socks5/socks5.go @@ -229,6 +229,10 @@ func ClientHandshake(rw io.ReadWriter, addr Addr, command Command, user *User) ( } if buf[1] == 2 { + if user == nil { + return nil, ErrAuth + } + // password protocol version authMsg := &bytes.Buffer{} authMsg.WriteByte(1)