From 0558066261625d0f4e7d5c118a0efd4238d24715 Mon Sep 17 00:00:00 2001 From: Sergey Elantsev Date: Sun, 20 Dec 2020 18:13:10 +0300 Subject: fixed possible crashes on parsing of bgp messages --- pkg/packet/bgp/prefix_sid.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg/packet/bgp/prefix_sid.go') diff --git a/pkg/packet/bgp/prefix_sid.go b/pkg/packet/bgp/prefix_sid.go index a7983bcd..32f575ee 100644 --- a/pkg/packet/bgp/prefix_sid.go +++ b/pkg/packet/bgp/prefix_sid.go @@ -52,7 +52,7 @@ func (s *TLV) DecodeFromBytes(data []byte) ([]byte, error) { p++ s.Length = binary.BigEndian.Uint16(data[p : p+2]) - if len(data) < s.Len() { + if s.Len() < prefixSIDtlvHdrLen || len(data) < s.Len() { return nil, malformedAttrListErr("decoding failed: Prefix SID TLV malformed") } -- cgit v1.2.3