summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-bgp.c
diff options
context:
space:
mode:
authorMatthieu Texier <matthieu@texier.tv>2014-12-01 23:48:44 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2014-12-02 09:38:39 +0000
commitf260f9aa2d625bbd592dbaa3ef5a09dbf6c5f747 (patch)
tree0e4621607dbb2c91c6beee907cd6f7999fcd320e /epan/dissectors/packet-bgp.c
parent5eec6bb27a2957ace863172e8d7b5bad9d243a6a (diff)
downloadwireshark-f260f9aa2d625bbd592dbaa3ef5a09dbf6c5f747.tar.gz
BGP: Incorrect decoding AS numbers when mixed AS size
Fix AS Path Heuristic Issue reported by Jon Bug: 10742 Change-Id: Ie5e4108bd93464a2d1076dcc4f322171ea8e68cb Reviewed-on: https://code.wireshark.org/review/5564 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-bgp.c')
-rw-r--r--epan/dissectors/packet-bgp.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c
index 131e088f1e..56074b9d7e 100644
--- a/epan/dissectors/packet-bgp.c
+++ b/epan/dissectors/packet-bgp.c
@@ -5085,31 +5085,35 @@ heuristic_as2_or_4_from_as_path(tvbuff_t *tvb, gint as_path_offset, gint end_att
/* case of AS_PATH type being explicitly 4 bytes ASN */
if (bgpa_type == BGPTYPE_AS4_PATH) {
/* We calculate numbers of segments and return the as length */
+ assumed_as_len = 4;
while (k < end_attr_offset)
{
+ /* we skip segment type and point to length */
+ k++;
length = tvb_get_guint8(tvb, k);
+ /* length read let's move to first ASN */
+ k++;
/* we move to the next segment */
k = k + (length*assumed_as_len);
- /* if I am not facing the last segment k need to point to next length */
- if(k < end_attr_offset)
- k++;
counter_as_segment++;
}
*number_as_segment = counter_as_segment;
- bgp_asn_len = 4;
return(4);
}
/* case of user specified ASN length */
if (bgp_asn_len != 0) {
/* We calculate numbers of segments and return the as length */
+ assumed_as_len = bgp_asn_len;
while (k < end_attr_offset)
{
+ /* we skip segment type and point to length */
+ k++;
length = tvb_get_guint8(tvb, k);
+ /* length read let's move to first ASN */
+ k++;
/* we move to the next segment */
k = k + (length*assumed_as_len);
/* if I am not facing the last segment k need to point to next length */
- if(k < end_attr_offset)
- k++;
counter_as_segment++;
}
*number_as_segment = counter_as_segment;
@@ -5739,7 +5743,6 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
if(tlen == 0) {
proto_item_append_text(ti_pa,"empty");
}
-
q = o + i + aoff;
for (k=0; k < number_as_segment; k++)
{