diff --git a/proxy/socks/protocol.go b/proxy/socks/protocol.go index 9bccf607..76ceb47c 100644 --- a/proxy/socks/protocol.go +++ b/proxy/socks/protocol.go @@ -353,6 +353,11 @@ func EncodeUDPPacket(request *protocol.RequestHeader, data []byte) (*buf.Buffer, b.Release() return nil, err } + // if data is too large, return an empty buffer (drop too big data) + if b.Available() < int32(len(data)) { + b.Clear() + return b, nil + } common.Must2(b.Write(data)) return b, nil }