mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-12-02 02:26:47 +00:00
fix: trojan protocol WaitReadFrom panic via oversized UDP relay length field
This commit is contained in:
1 parent
11848509fb
commit
5bdb1cc7e1
1 file changed
+6
@@ -202,6 +202,12 @@ func (pc *PacketConn) WaitReadFrom() (data []byte, put func(), addr net.Addr, er
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
length := binary.BigEndian.Uint16(data)
|
||||
if length > maxLength {
|
||||
if put != nil {
|
||||
put()
|
||||
}
|
||||
return nil, nil, nil, errors.New("packet invalid")
|
||||
}
|
||||
|
||||
if length > 0 {
|
||||
data = data[:length]
|
||||
|
||||
Reference in new issue
Block a user