Skip to content
Permalink
Browse files Browse the repository at this point in the history
Merge pull request from GHSA-x462-89pf-6r5h
  • Loading branch information
calmh committed Apr 6, 2021
1 parent 0d7a77b commit fb4fdaf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/relay/protocol/protocol.go
Expand Up @@ -4,6 +4,7 @@ package protocol

import (
"errors"
"fmt"
"io"
)

Expand Down Expand Up @@ -86,6 +87,9 @@ func ReadMessage(r io.Reader) (interface{}, error) {
if header.magic != magic {
return nil, errors.New("magic mismatch")
}
if header.messageLength < 0 || header.messageLength > 1024 {
return nil, fmt.Errorf("bad length (%d)", header.messageLength)
}

buf = make([]byte, int(header.messageLength))
if _, err := io.ReadFull(r, buf); err != nil {
Expand Down

0 comments on commit fb4fdaf

Please sign in to comment.