summaryrefslogtreecommitdiffhomepage
path: root/packet/bgp/bgp.go
diff options
context:
space:
mode:
Diffstat (limited to 'packet/bgp/bgp.go')
-rw-r--r--packet/bgp/bgp.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go
index b7ee98cb..2de2af63 100644
--- a/packet/bgp/bgp.go
+++ b/packet/bgp/bgp.go
@@ -666,6 +666,9 @@ func (msg *BGPOpen) DecodeFromBytes(data []byte) error {
for rest := msg.OptParamLen; rest > 0; {
paramtype := data[0]
paramlen := data[1]
+ if rest < paramlen+2 {
+ return fmt.Errorf("Malformed BGP Open message")
+ }
rest -= paramlen + 2
if paramtype == BGP_OPT_CAPABILITY {