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 <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2017-01-24 22:17:49 -05:00
parent ee177fedb4
commit eeab554cf2
1 changed files with 3 additions and 23 deletions

View File

@ -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);
}