mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-09 13:48:41 +00:00
Add packet length valid check
This commit is contained in:
parent
7484097da8
commit
e3b9e2543b
1 changed files with 5 additions and 1 deletions
|
@ -4,8 +4,8 @@ import (
|
|||
"crypto"
|
||||
"crypto/aes"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/quic-go/quic-go/quicvarint"
|
||||
|
@ -169,6 +169,10 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// very stange packet length, maybe a fake QUIC header
|
||||
if packetNumberLength > int(packetLen) {
|
||||
return nil, errNotQuic
|
||||
}
|
||||
extHdrLen := hdrLen + packetNumberLength
|
||||
data := b[extHdrLen : int(packetLen)+hdrLen]
|
||||
decrypted, err := cipher.Open(b[extHdrLen:extHdrLen], nonce, data, b[:extHdrLen])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue