From 291061e9da6a5e1777f79c76e8c0859df8db821c Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Sat, 21 Oct 2023 03:12:46 -0400 Subject: [PATCH] Fix an edge case reshaping buffer too long --- proxy/proxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/proxy.go b/proxy/proxy.go index a14ddace..4dcb6bf9 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -257,7 +257,7 @@ func ReshapeMultiBuffer(ctx context.Context, buffer buf.MultiBuffer) buf.MultiBu for i, buffer1 := range buffer { if buffer1.Len() >= buf.Size-21 { index := int32(bytes.LastIndex(buffer1.Bytes(), TlsApplicationDataStart)) - if index <= 0 || index > buf.Size-21 { + if index < 21 || index > buf.Size-21 { index = buf.Size / 2 } buffer2 := buf.New()