summaryrefslogtreecommitdiffhomepage
path: root/packet/bmp_test.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-11-19 16:17:23 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-11-19 16:17:23 -0800
commit2b15188fe196bb2210ed4e24b776746469215318 (patch)
treedc8a043a81aa445e3318638c1ed813c3de0b70cf /packet/bmp_test.go
parentc130ea5b11da6974e5dda4613f771a418b05ce9b (diff)
bmp: fix ParseBMPMessage to handle failure of parsing header
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'packet/bmp_test.go')
-rw-r--r--packet/bmp_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/packet/bmp_test.go b/packet/bmp_test.go
index c1226088..e07c2455 100644
--- a/packet/bmp_test.go
+++ b/packet/bmp_test.go
@@ -16,6 +16,7 @@
package bgp
import (
+ "github.com/stretchr/testify/assert"
"reflect"
"testing"
)
@@ -64,3 +65,9 @@ func Test_RouteMonitoring(t *testing.T) {
p0 := NewBMPPeerHeader(0, false, 1000, "fe80::6e40:8ff:feab:2c2a", 70000, "10.0.0.2", 1)
verify(t, NewBMPRouteMonitoring(*p0, m))
}
+
+func Test_BogusHeader(t *testing.T) {
+ h, err := ParseBMPMessage(make([]byte, 10))
+ assert.Nil(t, h)
+ assert.NotNil(t, err)
+}