From eeab554cf2e1d893f144081a762cc52782271e2e Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Tue, 24 Jan 2017 22:17:49 -0500 Subject: [PATCH] ldss: Ensure ldss_file_request_t structure gets allocated Bug: 13346 Change-Id: I83175fefeef5035039e378dd68ffdcd0787970b8 Reviewed-on: https://code.wireshark.org/review/19775 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-ldss.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/epan/dissectors/packet-ldss.c b/epan/dissectors/packet-ldss.c index 56f33188fb..7ae78fd870 100644 --- a/epan/dissectors/packet-ldss.c +++ b/epan/dissectors/packet-ldss.c @@ -203,9 +203,6 @@ static expert_field ei_ldss_unrecognized_line = EI_INIT; static dissector_handle_t ldss_udp_handle; static dissector_handle_t ldss_tcp_handle; -/* Avoid creating conversations and data twice */ -static unsigned int highest_num_seen = 0; - /* When seeing a broadcast talking about an open TCP port on a host, create * a conversation to dissect anything sent/received at that address. Setup * protocol data so the TCP dissection knows what broadcast triggered it. */ @@ -397,9 +394,8 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * These steps only need to be done once per packet, so a variable * tracks the highest frame number seen. Handles the case of first frame * being frame zero. */ - if (messageDetail != INFERRED_PEERSHUTDOWN && - (highest_num_seen == 0 || - highest_num_seen < pinfo->num)) { + if ((messageDetail != INFERRED_PEERSHUTDOWN) && + !PINFO_FD_VISITED(pinfo)) { ldss_broadcast_t *data; @@ -426,9 +422,6 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (port > 0) { prepare_ldss_transfer_conv(data); } - - /* Record that the frame was processed */ - highest_num_seen = pinfo->num; } return tvb_captured_length(tvb); @@ -489,13 +482,11 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void col_set_str(pinfo->cinfo, COL_INFO, "LDSS File Transfer (Requesting file - pull)"); - if (highest_num_seen == 0 || - highest_num_seen < pinfo->num) { + if (transfer_info->req == NULL) { already_dissected = FALSE; transfer_info->req = wmem_new0(wmem_file_scope(), ldss_file_request_t); transfer_info->req->file = wmem_new0(wmem_file_scope(), ldss_file_t); - highest_num_seen = pinfo->num; } ti = proto_tree_add_item(tree, proto_ldss, @@ -791,15 +782,6 @@ dissect_ldss (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U return 0; } -/* Initialize the highest num seen each time a - * new file is loaded or re-loaded in wireshark */ -static void -ldss_init_protocol(void) -{ - /* We haven't dissected anything yet. */ - highest_num_seen = 0; -} - void proto_register_ldss (void) { static hf_register_info hf[] = { @@ -960,8 +942,6 @@ proto_register_ldss (void) { proto_register_subtree_array(ett, array_length(ett)); expert_ldss = expert_register_protocol(proto_ldss); expert_register_field_array(expert_ldss, ei, array_length(ei)); - - register_init_routine(&ldss_init_protocol); }