From a6ae13dee97af192794a604f348a31b505926d47 Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Sun, 8 Sep 2013 21:10:36 +0000 Subject: Slightly different fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9117 : Check that tvb returned by dissect_per_bit_string is not null before trying to use it svn path=/trunk/; revision=51846 --- epan/dissectors/packet-atn-ulcs.c | 128 +++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 63 deletions(-) (limited to 'epan/dissectors/packet-atn-ulcs.c') diff --git a/epan/dissectors/packet-atn-ulcs.c b/epan/dissectors/packet-atn-ulcs.c index 14a000b331..74a2f58e56 100644 --- a/epan/dissectors/packet-atn-ulcs.c +++ b/epan/dissectors/packet-atn-ulcs.c @@ -391,71 +391,73 @@ dissect_atn_ulcs_T_pdv_list_presentation_data_values_arbitrary(tvbuff_t *tvb _U_ FALSE, &tvb_usr); - /* call appropiate dissector for bitstring data */ - switch(ulcs_context_value){ - case 1: /* ACSE PDU*/ - ti = proto_tree_add_text( - root_tree, - tvb, - offset, - 0, - ATN_ACSE_PROTO ); - atn_ulcs_tree = proto_item_add_subtree(ti, ett_atn_acse); + if (tvb_usr) { + /* call appropiate dissector for bitstring data */ + switch(ulcs_context_value){ + case 1: /* ACSE PDU*/ + ti = proto_tree_add_text( + root_tree, + tvb, + offset, + 0, + ATN_ACSE_PROTO ); + atn_ulcs_tree = proto_item_add_subtree(ti, ett_atn_acse); - dissect_ACSE_apdu_PDU( - tvb_new_subset_remaining(tvb_usr, 0), - pinfo, - atn_ulcs_tree); - break; - case 3: /* USER data; call subdissector for CM, CPDLC ... */ - - /* using dstref for PDV-list only occurrs in DT */ - atn_cv = find_atn_conversation( - &pinfo->dst, - pinfo->clnp_dstref, - &pinfo->src); - - if(atn_cv) { - switch(atn_cv->ae_qualifier){ - case cma: /* contact management */ - call_dissector_with_data( - atn_cm_handle, - tvb_new_subset_remaining(tvb_usr, 0), - pinfo, - root_tree, - NULL); - break; - case cpdlc: /* plain old cpdlc */ - case pmcpdlc: /* protected mode cpdlc */ - call_dissector_with_data( - atn_cpdlc_handle, - tvb_new_subset_remaining(tvb_usr, 0), - pinfo, - root_tree, - NULL); - break; - default: /* unknown or unhandled datalink application */ - dissector_try_heuristic( - atn_ulcs_heur_subdissector_list, - tvb_new_subset_remaining(tvb_usr,0), - actx->pinfo, - root_tree, - NULL); - break; - } - } - else{ - dissector_try_heuristic( - atn_ulcs_heur_subdissector_list, - tvb_new_subset_remaining(tvb_usr,0), - actx->pinfo, - root_tree, - NULL); - } - break; - default: + dissect_ACSE_apdu_PDU( + tvb_new_subset_remaining(tvb_usr, 0), + pinfo, + atn_ulcs_tree); break; - } /* switch(ulcs_context_value) */ + case 3: /* USER data; call subdissector for CM, CPDLC ... */ + + /* using dstref for PDV-list only occurrs in DT */ + atn_cv = find_atn_conversation( + &pinfo->dst, + pinfo->clnp_dstref, + &pinfo->src); + + if(atn_cv) { + switch(atn_cv->ae_qualifier){ + case cma: /* contact management */ + call_dissector_with_data( + atn_cm_handle, + tvb_new_subset_remaining(tvb_usr, 0), + pinfo, + root_tree, + NULL); + break; + case cpdlc: /* plain old cpdlc */ + case pmcpdlc: /* protected mode cpdlc */ + call_dissector_with_data( + atn_cpdlc_handle, + tvb_new_subset_remaining(tvb_usr, 0), + pinfo, + root_tree, + NULL); + break; + default: /* unknown or unhandled datalink application */ + dissector_try_heuristic( + atn_ulcs_heur_subdissector_list, + tvb_new_subset_remaining(tvb_usr,0), + actx->pinfo, + root_tree, + NULL); + break; + } + } + else{ + dissector_try_heuristic( + atn_ulcs_heur_subdissector_list, + tvb_new_subset_remaining(tvb_usr,0), + actx->pinfo, + root_tree, + NULL); + } + break; + default: + break; + } /* switch(ulcs_context_value) */ + } return offset; -- cgit v1.2.3