summaryrefslogtreecommitdiffhomepage
path: root/packet/bgp.go
diff options
context:
space:
mode:
Diffstat (limited to 'packet/bgp.go')
-rw-r--r--packet/bgp.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index aa76cb12..79f62978 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -2734,6 +2734,9 @@ func (msg *BGPMessage) Serialize() ([]byte, error) {
return nil, err
}
if msg.Header.Len == 0 {
+ if 19 + len(b) > BGP_MAX_MESSAGE_LENGTH {
+ return nil, NewMessageError(0, 0, nil, fmt.Sprintf("too long message length %d", 19 + len(b)))
+ }
msg.Header.Len = 19 + uint16(len(b))
}
h, err := msg.Header.Serialize()