Skip to content

Commit

Permalink
hysteria2: Fix missing message limit
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed May 12, 2024
1 parent a7af781 commit 4223bde
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hysteria2/internal/protocol/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ func ReadTCPResponse(r io.Reader) (bool, string, error) {
}

func WriteTCPResponse(ok bool, msg string, payload []byte) *buf.Buffer {
if len(msg) > MaxMessageLength {
msg = msg[:MaxMessageLength]
}
padding := tcpResponsePadding.String()
paddingLen := len(padding)
msgLen := len(msg)
Expand Down Expand Up @@ -198,7 +201,7 @@ func ParseUDPMessage(msg []byte) (*UDPMessage, error) {
if err != nil {
return nil, err
}
if lAddr == 0 || lAddr > MaxMessageLength {
if lAddr == 0 || lAddr > MaxAddressLength {
return nil, E.New("invalid address length")
}
bs := buf.Bytes()
Expand Down

0 comments on commit 4223bde

Please sign in to comment.