diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2013-10-05 18:29:17 +0000 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2013-10-05 18:29:17 +0000 |
commit | a15760bd63942e93c9d8a760e75201fac6faabdc (patch) | |
tree | dd2a41584728b6c6e4fae4fb47d7857f4073cbf2 /epan/dissectors/packet-nsip.c | |
parent | 7b3ac2ae6bdeac058c02d0d7f6d071f85dc04b91 (diff) |
From Jacob Erlbeck
Fix GPRS-NS protocol dissector for STATUS PDU
When a NS-STATUS message contains a PDU, the packet description
refers to the contained PDU and the offset is wrong, thus finding
information elements that are not present.
This fixes the implementation by checking, whether the PDU dissector
has been called recursively and by updating the offset correctly.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9221
(from me: use gboolean, separate variable declaration and initialization)
svn path=/trunk/; revision=52378
Diffstat (limited to 'epan/dissectors/packet-nsip.c')
-rw-r--r-- | epan/dissectors/packet-nsip.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/epan/dissectors/packet-nsip.c b/epan/dissectors/packet-nsip.c index 9bffadf1de..f4ec054964 100644 --- a/epan/dissectors/packet-nsip.c +++ b/epan/dissectors/packet-nsip.c @@ -228,6 +228,8 @@ static const value_string ip_address_type_vals[] = { static dissector_handle_t bssgp_handle; static dissector_handle_t nsip_handle; +static gboolean nsip_is_recursive = FALSE; + typedef struct { guint8 iei; guint8 presence_req; @@ -342,11 +344,13 @@ decode_iei_ns_pdu(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) { } next_tvb = tvb_new_subset(bi->tvb, bi->offset, ie->value_length, -1); if (nsip_handle) { + gboolean was_recursive; + was_recursive = nsip_is_recursive; + nsip_is_recursive = TRUE; call_dissector(nsip_handle, next_tvb, bi->pinfo, bi->nsip_tree); + nsip_is_recursive = was_recursive; } - else { - bi->offset += ie->value_length; - } + bi->offset += ie->value_length; } static void @@ -975,9 +979,10 @@ dissect_nsip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { pinfo->current_proto = "GPRS-NS"; - col_set_str(pinfo->cinfo, COL_PROTOCOL, "GPRS-NS"); - - col_clear(pinfo->cinfo, COL_INFO); + if (!nsip_is_recursive) { + col_set_str(pinfo->cinfo, COL_PROTOCOL, "GPRS-NS"); + col_clear(pinfo->cinfo, COL_INFO); + } pdu_type = tvb_get_guint8(tvb, 0); bi.offset++; @@ -992,8 +997,13 @@ dissect_nsip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { bi.nsip_tree = nsip_tree; } - col_add_str(pinfo->cinfo, COL_INFO, - val_to_str_const(pdu_type, tab_nsip_pdu_types, "Unknown PDU type")); + if (!nsip_is_recursive) { + col_add_str(pinfo->cinfo, COL_INFO, + val_to_str_const(pdu_type, tab_nsip_pdu_types, "Unknown PDU type")); + } else { + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NSIP_SEP, "%s", + val_to_str_const(pdu_type, tab_nsip_pdu_types, "Unknown PDU type")); + } decode_pdu(pdu_type, &bi); } |