Skip to content

Commit a50d26c

Browse files
Sam Lanciadaenney
Sam Lancia
authored andcommittedFeb 5, 2023
Fix panic unmarshalling hello verify request
This could cause us to panic when unmarshalling a Hello Verify request message.
1 parent 7a14903 commit a50d26c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

Diff for: ‎pkg/protocol/handshake/message_hello_verify_request.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ func (m *MessageHelloVerifyRequest) Unmarshal(data []byte) error {
5151
}
5252
m.Version.Major = data[0]
5353
m.Version.Minor = data[1]
54-
cookieLength := data[2]
55-
if len(data) < (int(cookieLength) + 3) {
54+
cookieLength := int(data[2])
55+
if len(data) < cookieLength+3 {
5656
return errBufferTooSmall
5757
}
5858
m.Cookie = make([]byte, cookieLength)

0 commit comments

Comments
 (0)