Skip to content

Commit

Permalink
fix UnmarshalBGPOpenMessage
Browse files Browse the repository at this point in the history
The minimum length of the OPEN message is 29 octets (including the
message header). The callers of this function exclude the marker
bytes.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
  • Loading branch information
fujita committed Dec 17, 2021
1 parent 342518f commit 8d8872f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/bgp/bgp-open.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func UnmarshalBGPOpenMessage(b []byte) (*OpenMessage, error) {
if glog.V(6) {
glog.Infof("BGPOpenMessage Raw: %s", tools.MessageHex(b))
}
if len(b) < BGPMinOpenMessageLength {
if len(b) < BGPMinOpenMessageLength-16 {
return nil, fmt.Errorf("BGP Open Message length %d is invalid", len(b))
}
var err error
Expand Down

0 comments on commit 8d8872f

Please sign in to comment.