summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-10-10 16:31:01 -0400
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2023-10-11 05:02:49 +0000
commit609ee2bd4b53d2f76ee489e02e981ca0329f6d10 (patch)
tree947666a456b6d3abff23a516e9468a95727a63c1
parent0f02b85a187cbaa001b34ab90ae368be5e638ccc (diff)
Revert "bgpd: fix illegal memory access in bgp_ls_tlv_check_size()"
This reverts commit dae5791c446cd18d8cda93a1e578fff2cd27be10. (cherry picked from commit 73a4891ab39bf22f5d0120b378fb7d6cd4b75dd5)
-rw-r--r--bgpd/bgp_linkstate_tlv.c8
-rw-r--r--bgpd/bgp_linkstate_tlv.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/bgpd/bgp_linkstate_tlv.c b/bgpd/bgp_linkstate_tlv.c
index 97a024d7cd..a8b13d7876 100644
--- a/bgpd/bgp_linkstate_tlv.c
+++ b/bgpd/bgp_linkstate_tlv.c
@@ -31,7 +31,7 @@ struct bgp_linkstate_tlv_info {
#define UNDEF_MULTPL 1
/* clang-format off */
-struct bgp_linkstate_tlv_info bgp_linkstate_tlv_infos[BGP_LS_TLV_MAX + 1] = {
+struct bgp_linkstate_tlv_info bgp_linkstate_tlv_infos[BGP_LS_TLV_MAX] = {
/* NLRI TLV */
[BGP_LS_TLV_LOCAL_NODE_DESCRIPTORS] = {"Local Node Descriptors", 1, MAX_SZ, UNDEF_MULTPL},
[BGP_LS_TLV_REMOTE_NODE_DESCRIPTORS] = {"Remote Node Descriptors", 1, MAX_SZ, UNDEF_MULTPL},
@@ -1705,7 +1705,7 @@ void bgp_linkstate_tlv_attribute_display(struct vty *vty,
json_tlv = json_object_new_object();
json_object_object_add(json, tlv_type, json_tlv);
- if (type <= BGP_LS_TLV_MAX &&
+ if (type < BGP_LS_TLV_MAX &&
bgp_linkstate_tlv_infos[type].descr != NULL)
json_object_string_add(
json_tlv, "description",
@@ -1720,7 +1720,7 @@ void bgp_linkstate_tlv_attribute_display(struct vty *vty,
"too high length received: %u", length);
break;
}
- if (type <= BGP_LS_TLV_MAX &&
+ if (type < BGP_LS_TLV_MAX &&
bgp_linkstate_tlv_infos[type].descr != NULL &&
!bgp_ls_tlv_check_size(type, length))
json_object_string_addf(
@@ -1728,7 +1728,7 @@ void bgp_linkstate_tlv_attribute_display(struct vty *vty,
"unexpected length received: %u",
length);
} else {
- if (type <= BGP_LS_TLV_MAX &&
+ if (type < BGP_LS_TLV_MAX &&
bgp_linkstate_tlv_infos[type].descr != NULL)
vty_out(vty, "%*s%s: ", indent, "",
bgp_linkstate_tlv_infos[type].descr);
diff --git a/bgpd/bgp_linkstate_tlv.h b/bgpd/bgp_linkstate_tlv.h
index cc543735b7..ad3b2570d6 100644
--- a/bgpd/bgp_linkstate_tlv.h
+++ b/bgpd/bgp_linkstate_tlv.h
@@ -197,7 +197,7 @@ enum bgp_linkstate_tlv {
1251, /* draft-ietf-idr-bgpls-srv6-ext-08 */
BGP_LS_TLV_SRV6_SID_STRUCTURE_TLV =
1252, /* draft-ietf-idr-bgpls-srv6-ext-08 */
- BGP_LS_TLV_MAX = 1252, /* max TLV value for table size*/
+ BGP_LS_TLV_MAX = 1253, /* max TLV value for table size*/
};
/* RFC7752 #3.2.1.4 IGP router-ID */