Fix parse hysteria UDP message

This commit is contained in:
shadow750d6 2023-02-09 13:20:16 +08:00 committed by GitHub
parent 19d08b55c8
commit c14b353a29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -293,6 +293,10 @@ func ParseUDPMessage(packet []byte) (message UDPMessage, err error) {
if err != nil { if err != nil {
return return
} }
if 6+int(hostLen) > len(packet) {
err = E.New("invalid host length")
return
}
message.Host = string(packet[6 : 6+hostLen]) message.Host = string(packet[6 : 6+hostLen])
err = binary.Read(reader, binary.BigEndian, &message.Port) err = binary.Read(reader, binary.BigEndian, &message.Port)
if err != nil { if err != nil {