diff options
Diffstat (limited to 'packet')
-rw-r--r-- | packet/bgp/bgp.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go index 9ad3a830..c072a210 100644 --- a/packet/bgp/bgp.go +++ b/packet/bgp/bgp.go @@ -791,6 +791,9 @@ func (msg *BGPOpen) DecodeFromBytes(data []byte) error { msg.OptParams = []OptionParameterInterface{} for rest := msg.OptParamLen; rest > 0; { + if rest < 2 { + return NewMessageError(BGP_ERROR_MESSAGE_HEADER_ERROR, BGP_ERROR_SUB_BAD_MESSAGE_LENGTH, nil, "Malformed BGP Open message") + } paramtype := data[0] paramlen := data[1] if rest < paramlen+2 { |