From c14b353a29c292a53f228a87c0d57cd18940e8e7 Mon Sep 17 00:00:00 2001 From: shadow750d6 <124365938+shadow750d6@users.noreply.github.com> Date: Thu, 9 Feb 2023 13:20:16 +0800 Subject: [PATCH] Fix parse hysteria UDP message --- transport/hysteria/protocol.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/transport/hysteria/protocol.go b/transport/hysteria/protocol.go index aa2eab30..beed65a3 100644 --- a/transport/hysteria/protocol.go +++ b/transport/hysteria/protocol.go @@ -293,6 +293,10 @@ func ParseUDPMessage(packet []byte) (message UDPMessage, err error) { if err != nil { return } + if 6+int(hostLen) > len(packet) { + err = E.New("invalid host length") + return + } message.Host = string(packet[6 : 6+hostLen]) err = binary.Read(reader, binary.BigEndian, &message.Port) if err != nil {