Skip to content

Commit

Permalink
Fix unreleased cache buffer in QUIC sniffing (#3320)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vigilans authored Feb 20, 2025
1 parent 14bc04a commit 3d54bec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions common/protocol/quic/sniff.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
cryptoData := bytespool.Alloc(int32(len(b)))
defer bytespool.Free(cryptoData)

cache := buf.New()
defer cache.Release()

// Parse QUIC packets
for len(b) > 0 {
buffer := buf.FromBytes(b)
Expand Down Expand Up @@ -139,9 +142,7 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
return nil, err
}

cache := buf.New()
defer cache.Release()

cache.Clear()
mask := cache.Extend(int32(block.BlockSize()))
block.Encrypt(mask, b[hdrLen+4:hdrLen+4+16])
b[0] ^= mask[0] & 0xf
Expand Down

0 comments on commit 3d54bec

Please sign in to comment.