From 3dc69c99b0dcbaa221ae3fd011af8bbb9f04a1d4 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 16 Jan 2015 14:24:49 +0900 Subject: packet: handle malformed BGP Header Signed-off-by: FUJITA Tomonori --- packet/bgp.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packet/bgp.go') diff --git a/packet/bgp.go b/packet/bgp.go index c001686f..407b4b9f 100644 --- a/packet/bgp.go +++ b/packet/bgp.go @@ -2625,6 +2625,8 @@ func parseBody(h *BGPHeader, data []byte) (*BGPMessage, error) { msg.Body = &BGPKeepAlive{} case BGP_MSG_ROUTE_REFRESH: msg.Body = &BGPRouteRefresh{} + default: + return nil, NewMessageError(BGP_ERROR_MESSAGE_HEADER_ERROR, BGP_ERROR_SUB_BAD_MESSAGE_TYPE, nil, "unknown message type") } err := msg.Body.DecodeFromBytes(data) if err != nil { -- cgit v1.2.3