summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2021-01-20 00:38:42 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2021-01-20 01:21:29 +0100
commit89e404be46cfa30fdb994464a1c8e4fd93d3407f (patch)
tree48ab8c94caaea2991b5826906ce374ca8a3b4992
parent35e733246e1aff6688f2e4f624c7a80be33fb7b9 (diff)
packet/bgp: Fix TunnelEncapSubTLV.DecodeFromBytes
Return data of the correct length from TunnelEncapSubTLV.DecodeFromBytes. This fixes a problem with TunnelEncapSubTLVUnknown which caused it to contain more bytes in its Value unless it was the last SubTLV. Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
-rw-r--r--pkg/packet/bgp/bgp.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/packet/bgp/bgp.go b/pkg/packet/bgp/bgp.go
index 150c6c24..9add140f 100644
--- a/pkg/packet/bgp/bgp.go
+++ b/pkg/packet/bgp/bgp.go
@@ -11393,7 +11393,7 @@ func (t *TunnelEncapSubTLV) DecodeFromBytes(data []byte) (value []byte, err erro
if len(data) < int(t.Length) {
return nil, NewMessageError(BGP_ERROR_UPDATE_MESSAGE_ERROR, BGP_ERROR_SUB_MALFORMED_ATTRIBUTE_LIST, nil, "Not all TunnelEncapSubTLV bytes available")
}
- return data, nil
+ return data[:t.Length], nil
}
func (t *TunnelEncapSubTLV) Serialize(value []byte) (buf []byte, err error) {