Skip to content

Commit f07ddba

Browse files
committed
fix: improve buffer handling in QUIC client hello processing
1 parent 1108777 commit f07ddba

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

common/sniff/quic.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,12 @@ sniff:
230230

231231
start := int(5 + offset)
232232
end := start + int(length)
233-
if ja3DataBuf.Len() < end {
233+
bufLen := ja3DataBuf.Len()
234+
if bufLen < end {
234235
if ja3DataBuf.Cap() < end {
235236
return io.ErrShortBuffer
236237
}
237-
ja3DataBuf.Truncate(end)
238+
ja3DataBuf.WriteZeroN(end - bufLen)
238239
}
239240

240241
_, err = decryptedReader.Read(ja3DataBuf.Range(start, end))

0 commit comments

Comments
 (0)