From 548646fb06489cc05559cfa47bd6455ac9b5ae87 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Thu, 4 Apr 2024 02:50:15 -0400 Subject: [PATCH] Fix an edge case with tls hello fragment --- proxy/freedom/freedom.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proxy/freedom/freedom.go b/proxy/freedom/freedom.go index 55853646..0176929c 100644 --- a/proxy/freedom/freedom.go +++ b/proxy/freedom/freedom.go @@ -373,6 +373,9 @@ func (f *FragmentWriter) Write(b []byte) (int, error) { return f.writer.Write(b) } recordLen := 5 + ((int(b[3]) << 8) | int(b[4])) + if len(b) < recordLen { // maybe already fragmented somehow + return f.writer.Write(b) + } data := b[5:recordLen] buf := make([]byte, 1024) for from := 0; ; {