Sfoglia il codice sorgente

Fix an edge case with tls hello fragment

yuhan6665 1 anno fa
parent
commit
548646fb06
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      proxy/freedom/freedom.go

+ 3 - 0
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; ; {