summaryrefslogtreecommitdiffhomepage
path: root/pkg/packet/bgp/prefix_sid.go
diff options
context:
space:
mode:
authorSergey Elantsev <elantsev.s@yandex.ru>2020-12-20 18:13:10 +0300
committerSergey Elantsev <elantsev.s@yandex.ru>2020-12-20 18:13:10 +0300
commit0558066261625d0f4e7d5c118a0efd4238d24715 (patch)
treec525c80171c1664d6f5f6cdab0eef36d3874d4ed /pkg/packet/bgp/prefix_sid.go
parent5aa7108d85b6926eca99978a2fb0e728176aae98 (diff)
fixed possible crashes on parsing of bgp messages
Diffstat (limited to 'pkg/packet/bgp/prefix_sid.go')
-rw-r--r--pkg/packet/bgp/prefix_sid.go2
1 files changed, 1 insertions, 1 deletions
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")
}