diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-12-22 16:16:47 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-12-22 16:56:18 +0900 |
commit | 634c408903fffd5f4a13016cf29d23cb652cf3d0 (patch) | |
tree | c9dff9cf0e7087e2b01bda49f5a56161cb08ec68 /packet/bgp.go | |
parent | a37e4eac6ccb76eada55a385c65ccee316188694 (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.go | 6 |
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: |