mirror of
https://github.com/MetaCubeX/Clash.Meta.git
synced 2025-04-19 08:40:57 +00:00
chore: quic sniffer should use the exact length of crypto stream when assembling
This commit is contained in:
parent
84cd0ef688
commit
fe01033efe
1 changed files with 12 additions and 4 deletions
|
@ -399,9 +399,7 @@ func (q *quicPacketSender) readQuicData(b []byte) error {
|
|||
}
|
||||
}
|
||||
|
||||
_ = q.tryAssemble()
|
||||
|
||||
return nil
|
||||
return q.tryAssemble()
|
||||
}
|
||||
|
||||
func (q *quicPacketSender) tryAssemble() error {
|
||||
|
@ -415,7 +413,17 @@ func (q *quicPacketSender) tryAssemble() error {
|
|||
|
||||
if len(q.ranges) != 1 || q.ranges[0].Start() != 0 || q.ranges[0].End() != uint64(len(q.buffer)) {
|
||||
q.lock.RUnlock()
|
||||
return ErrNoClue
|
||||
// incomplete fragment, just return
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(q.buffer) <= 4 ||
|
||||
// Handshake Type (1) + uint24 Length (3) + ClientHello body
|
||||
// maxCryptoStreamOffset is in the valid range of uint16 so just ignore the q.buffer[1]
|
||||
int(binary.BigEndian.Uint16([]byte{q.buffer[2], q.buffer[3]})+4) != len(q.buffer) {
|
||||
q.lock.RUnlock()
|
||||
// end of segment not reached, just return
|
||||
return nil
|
||||
}
|
||||
|
||||
domain, err := ReadClientHello(q.buffer)
|
||||
|
|
Loading…
Add table
Reference in a new issue