From 147a7ce779b7ff89f82481ecf7c26e8f3b8da71e Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> 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)