mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-03 15:55:20 -05:00
QUIC sniffer: Fix potential slice panic (#3406)
* QUIC sniffer: Fix potential slice panic * Fix type err * Update sniff.go * Add test and fix more * Refine
This commit is contained in:
@@ -239,3 +239,21 @@ func TestSniffQUICComplex(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSniffFakeQUICPacketWithInvalidPacketNumberLength(t *testing.T) {
|
||||
pkt, err := hex.DecodeString("cb00000001081c8c6d5aeb53d54400000090709b8600000000000000000000000000000000")
|
||||
common.Must(err)
|
||||
_, err = quic.SniffQUIC(pkt)
|
||||
if err == nil {
|
||||
t.Error("failed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSniffFakeQUICPacketWithTooShortData(t *testing.T) {
|
||||
pkt, err := hex.DecodeString("cb00000001081c8c6d5aeb53d54400000090709b86")
|
||||
common.Must(err)
|
||||
_, err = quic.SniffQUIC(pkt)
|
||||
if err == nil {
|
||||
t.Error("failed")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user