aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorUli Heilmeier <uh@heilmeier.eu>2016-11-16 23:32:34 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2016-11-17 06:49:57 +0000
commitde5580a8ff5f8558386c51c7d56f09970d553fe3 (patch)
treefdd0249fdfaa56d5956b2ffbc768d3c49a7c7c10 /epan
parent9c514d8fc312aa1ff0485d1ce7b1e833ed629662 (diff)
BGP: Fix length in decode_prefix4()
When decode_prefix4() gets called with more prefixes the length of proto_tree_add_subtree_format() should not be the total length. As the "Withdrawn route" part was the only one where decode_prefix4() has been called with a tlen not equal 0 we can eliminate the tlen parameter. Bug: 13146 Change-Id: I708dec2cecbed6054b60190104b82c72d54e8037 Reviewed-on: https://code.wireshark.org/review/18852 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-bgp.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c
index e8526d617c..512a41bb8c 100644
--- a/epan/dissectors/packet-bgp.c
+++ b/epan/dissectors/packet-bgp.c
@@ -2199,7 +2199,7 @@ decode_path_prefix4(proto_tree *tree, packet_info *pinfo, int hf_path_id, int hf
*/
static int
decode_prefix4(proto_tree *tree, packet_info *pinfo, proto_item *parent_item, int hf_addr, tvbuff_t *tvb, gint offset,
- guint16 tlen, const char *tag)
+ const char *tag)
{
proto_tree *prefix_tree;
union {
@@ -2222,7 +2222,7 @@ decode_prefix4(proto_tree *tree, packet_info *pinfo, proto_item *parent_item, in
/* put prefix into protocol tree */
set_address(&addr, AT_IPv4, 4, ip_addr.addr_bytes);
prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
- tlen != 0 ? tlen : 1 + length, ett_bgp_prefix, NULL,
+ 1 + length, ett_bgp_prefix, NULL,
"%s/%u", address_to_str(wmem_packet_scope(), &addr), plen);
proto_item_append_text(parent_item, " (%s/%u)",
@@ -2748,7 +2748,7 @@ decode_flowspec_nlri(proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 afi,
cursor_fspec++;
if (afi == AFNUM_INET)
filter_len = decode_prefix4(filter_tree, pinfo, filter_item, hf_bgp_flowspec_nlri_dst_pref_ipv4,
- tvb, offset+cursor_fspec, 0, "Destination IP filter");
+ tvb, offset+cursor_fspec, "Destination IP filter");
else /* AFNUM_INET6 */
filter_len = decode_fspec_match_prefix6(filter_tree, filter_item, hf_bgp_flowspec_nlri_dst_ipv6_pref,
tvb, offset+cursor_fspec, 0, pinfo);
@@ -2759,7 +2759,7 @@ decode_flowspec_nlri(proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 afi,
cursor_fspec++;
if (afi == AFNUM_INET)
filter_len = decode_prefix4(filter_tree, pinfo, filter_item, hf_bgp_flowspec_nlri_src_pref_ipv4,
- tvb, offset+cursor_fspec, 0, "Source IP filter");
+ tvb, offset+cursor_fspec, "Source IP filter");
else /* AFNUM_INET6 */
filter_len = decode_fspec_match_prefix6(filter_tree, filter_item, hf_bgp_flowspec_nlri_src_ipv6_pref,
tvb, offset+cursor_fspec, 0, pinfo);
@@ -3642,7 +3642,7 @@ static int decode_bgp_link_nlri_prefix_descriptors(tvbuff_t *tvb,
case BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION:
if (decode_prefix4(tlv_sub_tree, pinfo, tlv_sub_item, hf_bgp_ls_nlri_ip_reachability_prefix_ip,
- tvb, offset + 4, 0, "Reachability") == -1)
+ tvb, offset + 4, "Reachability") == -1)
return diss_length;
break;
}
@@ -4747,7 +4747,7 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
case SAFNUM_UNICAST:
case SAFNUM_MULCAST:
case SAFNUM_UNIMULC:
- total_length = decode_prefix4(tree, pinfo, NULL,hf_addr4, tvb, offset, 0, tag);
+ total_length = decode_prefix4(tree, pinfo, NULL,hf_addr4, tvb, offset, tag);
if (total_length < 0)
return -1;
break;
@@ -7374,7 +7374,7 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
}
} else {
while (o < end) {
- i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_withdrawn_prefix, tvb, o, len,
+ i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_withdrawn_prefix, tvb, o,
"Withdrawn route");
if (i < 0)
return;
@@ -7417,8 +7417,7 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
} else {
/* Standard prefixes */
while (o < end) {
- i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_nlri_prefix, tvb, o, 0,
- "NLRI");
+ i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_nlri_prefix, tvb, o, "NLRI");
if (i < 0)
return;
o += i;
@@ -7585,7 +7584,7 @@ example 2
proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_prefixmask_upper, tvb, p, 1, ENC_BIG_ENDIAN);
p++;
- advance = decode_prefix4(subtree1, pinfo, NULL, hf_bgp_route_refresh_orf_entry_ip, tvb, p, 0, "ORF");
+ advance = decode_prefix4(subtree1, pinfo, NULL, hf_bgp_route_refresh_orf_entry_ip, tvb, p, "ORF");
if (advance < 0)
break;
entrylen = 7 + 1 + advance;