mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-06-09 05:59:54 +00:00
fix: tweak
This commit is contained in:
parent
d513ae115b
commit
131306b72b
@ -212,8 +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) {
|
if len(bs) <= int(lAddr) {
|
||||||
return nil, errors.ProtocolError{Message: "message length mismatch"}
|
// We use <= instead of < here as we expect at least one byte of data after the address
|
||||||
|
return nil, errors.ProtocolError{Message: "invalid message length"}
|
||||||
}
|
}
|
||||||
m.Addr = string(bs[:lAddr])
|
m.Addr = string(bs[:lAddr])
|
||||||
m.Data = bs[lAddr:]
|
m.Data = bs[lAddr:]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user