From 3d54bec86a277d521279ba0c2e1353d02fbbfd02 Mon Sep 17 00:00:00 2001 From: Vigilans Date: Fri, 21 Feb 2025 04:57:11 +0800 Subject: [PATCH] Fix unreleased cache buffer in QUIC sniffing (#3320) --- common/protocol/quic/sniff.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/protocol/quic/sniff.go b/common/protocol/quic/sniff.go index 2cf15fd20..77eef605a 100644 --- a/common/protocol/quic/sniff.go +++ b/common/protocol/quic/sniff.go @@ -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) @@ -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