diff options
author | kishiguro <ishi@hash-set.com> | 2016-11-29 01:06:46 -0800 |
---|---|---|
committer | kishiguro <ishi@hash-set.com> | 2016-11-29 01:06:46 -0800 |
commit | 0f5f9078ea27de52756c63fbf87f9eb286f829d8 (patch) | |
tree | 4a774f2e6a22be08bea0be74d5723e431da12c4c /packet/bgp/bgp.go | |
parent | 9f13bbed20f6957310ef8c54c2cc3ff015274667 (diff) |
Fix Open Message optional parameter length == 1 GoBGP crashes issues.
Diffstat (limited to 'packet/bgp/bgp.go')
-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 { |