Fix potential panic

This commit is contained in:
Fangliding 2026-07-11 03:39:24 +08:00
parent 1aabe7ea78
commit e1d4a04fb4
No known key found for this signature in database
GPG Key ID: 5427291C4BF43F03

View File

@ -143,7 +143,9 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
if err != nil {
return nil, err
}
if len(b) < hdrLen+4+block.BlockSize() {
return nil, errNotQuic
}
cache.Clear()
mask := cache.Extend(int32(block.BlockSize()))
block.Encrypt(mask, b[hdrLen+4:hdrLen+4+len(mask)])