diff options
author | Anders Broman <anders.broman@ericsson.com> | 2011-10-19 17:59:47 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2011-10-19 17:59:47 +0000 |
commit | 24a011d8db738e3d04b10455b159b973d4e86190 (patch) | |
tree | b46c3cad6405328fc4b1d0ce4b2aad5b7be0d02c /asn1/tcap | |
parent | 71ecdce1b9c354f0a023c16fa65a4e3dd0880bd8 (diff) |
Let subdissectors have a stab at the packet even if it's cut short.
svn path=/trunk/; revision=39472
Diffstat (limited to 'asn1/tcap')
-rw-r--r-- | asn1/tcap/packet-tcap-template.c | 121 | ||||
-rw-r--r-- | asn1/tcap/tcap.cnf | 9 |
2 files changed, 70 insertions, 60 deletions
diff --git a/asn1/tcap/packet-tcap-template.c b/asn1/tcap/packet-tcap-template.c index 5034d15d1a..be3dbf431d 100644 --- a/asn1/tcap/packet-tcap-template.c +++ b/asn1/tcap/packet-tcap-template.c @@ -39,6 +39,7 @@ #include <string.h> #include "packet-ber.h" #include "packet-tcap.h" +#include "packet-frame.h" #include <epan/tcap-persistentdata.h> #define PNAME "Transaction Capabilities Application Part" @@ -440,66 +441,66 @@ dissect_tcap_param(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset while (tvb_reported_length_remaining(tvb, offset) > 0) { - saved_offset = offset; - - offset = get_ber_identifier(tvb, offset, &class, &pc, &tag); - tag_offset = offset; - offset = get_ber_length(tvb, offset, &len, &ind_field); - len_offset = offset; - - tag_length = tag_offset - saved_offset; - len_length = len_offset - tag_offset; - - if (pc) - { - pi = proto_tree_add_text(tree, tvb, saved_offset, - len + (len_offset - saved_offset), - "CONSTRUCTOR"); - subtree = proto_item_add_subtree(pi, ett_param); - proto_tree_add_uint_format(subtree, hf_tcap_tag, tvb, - saved_offset, tag_length, tag, - "CONSTRUCTOR Tag"); - proto_tree_add_uint(subtree, hf_tcap_tag, tvb, saved_offset, - tag_length, class); - - proto_tree_add_uint(subtree, hf_tcap_length, tvb, tag_offset, - len_length, len); - - if (len-(2*ind_field)) /*should always be positive unless we get an empty contructor pointless? */ - { - next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field), - len-(2*ind_field)); - dissect_tcap_param(actx, subtree,next_tvb,0); - } - - if (ind_field) - proto_tree_add_text(subtree, tvb, offset+len-2, 2, "CONSTRUCTOR EOC"); - - offset += len; - } - else - { - pi = proto_tree_add_text(tree, tvb, saved_offset, - len + (len_offset - saved_offset), - "Parameter (0x%.2x)", tag); - - subtree = proto_item_add_subtree(pi, ett_param); - - proto_tree_add_uint(subtree, hf_tcap_tag, tvb, saved_offset, - tag_length, tag); - - proto_tree_add_uint(subtree, hf_tcap_length, tvb, - saved_offset+tag_length, len_length, len); - - if (len) /* check for NULLS */ - { - next_tvb = tvb_new_subset(tvb, offset, len, len); - dissect_ber_octet_string(TRUE, actx, tree, next_tvb, 0, - hf_tcap_data, NULL); - } - - offset += len; - } + saved_offset = offset; + + offset = get_ber_identifier(tvb, offset, &class, &pc, &tag); + tag_offset = offset; + offset = get_ber_length(tvb, offset, &len, &ind_field); + len_offset = offset; + + tag_length = tag_offset - saved_offset; + len_length = len_offset - tag_offset; + + if (pc) + { + pi = proto_tree_add_text(tree, tvb, saved_offset, + len + (len_offset - saved_offset), + "CONSTRUCTOR"); + subtree = proto_item_add_subtree(pi, ett_param); + proto_tree_add_uint_format(subtree, hf_tcap_tag, tvb, + saved_offset, tag_length, tag, + "CONSTRUCTOR Tag"); + proto_tree_add_uint(subtree, hf_tcap_tag, tvb, saved_offset, + tag_length, class); + + proto_tree_add_uint(subtree, hf_tcap_length, tvb, tag_offset, + len_length, len); + + if (len-(2*ind_field)) /*should always be positive unless we get an empty contructor pointless? */ + { + next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field), + len-(2*ind_field)); + dissect_tcap_param(actx, subtree,next_tvb,0); + } + + if (ind_field) + proto_tree_add_text(subtree, tvb, offset+len-2, 2, "CONSTRUCTOR EOC"); + + offset += len; + } + else + { + pi = proto_tree_add_text(tree, tvb, saved_offset, + len + (len_offset - saved_offset), + "Parameter (0x%.2x)", tag); + + subtree = proto_item_add_subtree(pi, ett_param); + + proto_tree_add_uint(subtree, hf_tcap_tag, tvb, saved_offset, + tag_length, tag); + + proto_tree_add_uint(subtree, hf_tcap_length, tvb, + saved_offset+tag_length, len_length, len); + + if (len) /* check for NULLS */ + { + next_tvb = tvb_new_subset(tvb, offset, len, len); + dissect_ber_octet_string(TRUE, actx, tree, next_tvb, 0, + hf_tcap_data, NULL); + } + + offset += len; + } } return offset; } diff --git a/asn1/tcap/tcap.cnf b/asn1/tcap/tcap.cnf index 74b9f06ccd..731d7e25af 100644 --- a/asn1/tcap/tcap.cnf +++ b/asn1/tcap/tcap.cnf @@ -91,7 +91,16 @@ next_tvb = tvb_new_subset(tvb, offset, len+comp_offset-offset, len+comp_offset-o if (!next_tvb) return comp_offset; +TRY { %(DEFAULT_BODY)s +} +CATCH(BoundsError) { + RETHROW; +} +CATCH(ReportedBoundsError) { + show_reported_bounds_error(tvb, actx->pinfo, tree); +} +ENDTRY; dissect_tcap_ITU_ComponentPDU(implicit_tag, next_tvb, 0, actx, tcap_top_tree, hf_index); |