From: Olivier Dugeon Date: Mon, 31 Jul 2017 16:03:00 +0000 (+0200) Subject: Correct build TLV functions X-Git-Tag: frr-4.0-dev~475^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=5d0df50febdd73cf29783efb60b6f4d2f36a3fc9;p=mirror%2Ffrr.git Correct build TLV functions * Functions that build TLVs in ospf_te.c and ospf_te.c use 'tlvh + 1' to move the pointer to the TLV payload ifor strem_put(). * Correct this by using TLV_DATA() macro which is saffer. Signed-off-by: Olivier Dugeon --- diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index e41b9c1524..13013bf8ca 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -506,7 +506,7 @@ static void build_tlv(struct stream *s, struct tlv_header *tlvh) if (ntohs(tlvh->type) != 0) { build_tlv_header(s, tlvh); - stream_put(s, tlvh + 1, TLV_BODY_SIZE(tlvh)); + stream_put(s, TLV_DATA(tlvh), TLV_BODY_SIZE(tlvh)); } return; } diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 521844b9ea..482d9d48c5 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -1065,7 +1065,7 @@ static void build_router_tlv(struct stream *s) struct tlv_header *tlvh = &OspfMplsTE.router_addr.header; if (ntohs(tlvh->type) != 0) { build_tlv_header(s, tlvh); - stream_put(s, tlvh + 1, TLV_BODY_SIZE(tlvh)); + stream_put(s, TLV_DATA(tlvh), TLV_BODY_SIZE(tlvh)); } return; } @@ -1075,7 +1075,7 @@ static void build_link_subtlv(struct stream *s, struct tlv_header *tlvh) if ((tlvh != NULL) && (ntohs(tlvh->type) != 0)) { build_tlv_header(s, tlvh); - stream_put(s, tlvh + 1, TLV_BODY_SIZE(tlvh)); + stream_put(s, TLV_DATA(tlvh), TLV_BODY_SIZE(tlvh)); } return; } @@ -2141,7 +2141,7 @@ static void ospf_mpls_te_show_info(struct vty *vty, struct ospf_lsa *lsa) case TE_TLV_LINK: sum += show_vty_link_header(vty, tlvh); subfunc = ospf_mpls_te_show_link_subtlv; - next = tlvh + 1; + next = TLV_DATA(tlvh); break; default: sum += show_vty_unknown_tlv(vty, tlvh);