aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-netflow.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2010-05-04 05:34:14 +0000
committerAnders Broman <anders.broman@ericsson.com>2010-05-04 05:34:14 +0000
commitcc0e177b54e765510653df48382af65cb46bccef (patch)
tree6afe353f9f5bb6ac2b070f6c3aba4935afe3956c /epan/dissectors/packet-netflow.c
parent384d4c9c4fcb9f3a739cdc21c0c0e2d2f889eb3b (diff)
From Andrew Feren:
Solve Problems decoding variable length strings in IPFIX. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4742 svn path=/trunk/; revision=32657
Diffstat (limited to 'epan/dissectors/packet-netflow.c')
-rw-r--r--epan/dissectors/packet-netflow.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/epan/dissectors/packet-netflow.c b/epan/dissectors/packet-netflow.c
index f722a635f5..df5a0d3ef9 100644
--- a/epan/dissectors/packet-netflow.c
+++ b/epan/dissectors/packet-netflow.c
@@ -520,6 +520,8 @@ static int hf_cflow_information_element_semantics = -1; /* ID: 344 */
static int hf_cflow_information_element_units = -1; /* ID: 345 */
static int hf_cflow_private_enterprise_number = -1; /* ID: 346 */
+/* pie = private information element */
+
static int hf_pie_cace_local_ipv4_address = -1;
static int hf_pie_cace_remote_ipv4_address = -1;
static int hf_pie_cace_local_ipv6_address = -1;
@@ -1311,7 +1313,7 @@ dissect_v9_data(tvbuff_t * tvb, packet_info * pinfo, proto_tree * pdutree, int o
pdu_len = dissect_v9_pdu(tvb, pinfo, data_tree, offset, tplt, hdrinfo);
- offset += tplt->length;
+ offset += pdu_len;
/* XXX - Throw an exception */
length -= pdu_len < length ? pdu_len : length;
}
@@ -1443,6 +1445,10 @@ dissect_v9_pdu_data(tvbuff_t * tvb, packet_info * pinfo, proto_tree * pdutree, i
int cmd_len;
gchar * cmd_str = NULL;
guint16 got_flags = 0;
+
+ gboolean vstr_long;
+ int vstr_len;
+
proto_item * ti;
const guint8 *reftime;
guint16 count = ipfix_scope_flag ? tplt->count_scopes : tplt->count;
@@ -3224,10 +3230,18 @@ dissect_v9_pdu_data(tvbuff_t * tvb, packet_info * pinfo, proto_tree * pdutree, i
break;
default:
- if ((type & 0x8000) && (pen != REVPEN))
- ti = proto_tree_add_text(pdutree, tvb, offset, length,
- "(%s) Type %u ",
- match_strval(pen, sminmpec_values), type & 0x7fff);
+ if (!length) {
+ vstr_len = tvb_get_guint8(tvb, offset);
+ if (vstr_len == 255) {
+ vstr_long = TRUE;
+ vstr_len = tvb_get_ntohs(tvb, offset+1);
+ } else { vstr_long = FALSE; }
+ length = vstr_len + (vstr_long?1+2:1);
+ }
+ if ((type & 0x8000) && (pen != REVPEN))
+ ti = proto_tree_add_text(pdutree, tvb, offset, length,
+ "(%s) Type %u ",
+ match_strval(pen, sminmpec_values), type & 0x7fff);
break;
}
if (ti && pen == REVPEN) {