summaryrefslogtreecommitdiffhomepage
path: root/packet/bgp.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-12-22 16:16:47 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-12-22 16:56:18 +0900
commit634c408903fffd5f4a13016cf29d23cb652cf3d0 (patch)
treec9dff9cf0e7087e2b01bda49f5a56161cb08ec68 /packet/bgp.go
parenta37e4eac6ccb76eada55a385c65ccee316188694 (diff)
packet: fix insufficient length check
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'packet/bgp.go')
-rw-r--r--packet/bgp.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index 61d36e4b..1cece5e5 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -5938,10 +5938,10 @@ type PathAttributeUnknown struct {
}
func GetPathAttribute(data []byte) (PathAttributeInterface, error) {
- if len(data) < 1 {
+ if len(data) < 2 {
eCode := uint8(BGP_ERROR_UPDATE_MESSAGE_ERROR)
- eSubCode := uint8(BGP_ERROR_SUB_MALFORMED_ATTRIBUTE_LIST)
- return nil, NewMessageError(eCode, eSubCode, nil, "attribute type length is short")
+ eSubCode := uint8(BGP_ERROR_SUB_ATTRIBUTE_LENGTH_ERROR)
+ return nil, NewMessageError(eCode, eSubCode, data, "attribute type length is short")
}
switch BGPAttrType(data[1]) {
case BGP_ATTR_TYPE_ORIGIN: