mirror of
https://github.com/apernet/hysteria.git
synced 2025-04-05 13:37:45 +03:00
fix: Fix slice out-of-bounds issues in ParseUDPMessage.
This commit is contained in:
parent
e57eeb986b
commit
d513ae115b
1 changed files with 3 additions and 0 deletions
|
@ -212,6 +212,9 @@ func ParseUDPMessage(msg []byte) (*UDPMessage, error) {
|
||||||
return nil, errors.ProtocolError{Message: "invalid address length"}
|
return nil, errors.ProtocolError{Message: "invalid address length"}
|
||||||
}
|
}
|
||||||
bs := buf.Bytes()
|
bs := buf.Bytes()
|
||||||
|
if len(bs) < int(lAddr) {
|
||||||
|
return nil, errors.ProtocolError{Message: "message length mismatch"}
|
||||||
|
}
|
||||||
m.Addr = string(bs[:lAddr])
|
m.Addr = string(bs[:lAddr])
|
||||||
m.Data = bs[lAddr:]
|
m.Data = bs[lAddr:]
|
||||||
return m, nil
|
return m, nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue