From b7d48fe7c5db81e2c435760f9fcfcc88ab8e5098 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Mon, 26 Feb 2018 17:50:14 +0100 Subject: [PATCH] prevent reading 0 bytes --- proxy/shadowsocks/protocol.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/shadowsocks/protocol.go b/proxy/shadowsocks/protocol.go index fb3f22b9..4ad68a88 100644 --- a/proxy/shadowsocks/protocol.go +++ b/proxy/shadowsocks/protocol.go @@ -68,7 +68,7 @@ func ReadTCPSession(user *protocol.User, reader io.Reader) (*protocol.RequestHea if err != nil { // Invalid address. Continue to read some bytes to confuse client. - nBytes := dice.Roll(32) + nBytes := dice.Roll(32) + 1 buffer.Clear() buffer.AppendSupplier(buf.ReadFullFrom(br, nBytes)) return nil, nil, newError("failed to read address").Base(err)