T38: fix a dereference of NULL pointer
authorPascal Quantin <pascal.quantin@gmail.com>
Sat, 24 Oct 2015 09:35:02 +0000 (11:35 +0200)
committerPascal Quantin <pascal.quantin@gmail.com>
Sat, 24 Oct 2015 12:50:39 +0000 (12:50 +0000)
Change-Id: I6d0a87e301145f43af0c0ccba44c1dbb2f84adb2
Ping-Bug: 9887
Reviewed-on: https://code.wireshark.org/review/11242
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
asn1/t38/packet-t38-template.c
epan/dissectors/packet-t38.c

index 58f943211e6db0d9bacc365dce8e392fd78224e1..eb209a1cafc51761e1536263ce9e77a27a02fb7d 100644 (file)
@@ -428,7 +428,7 @@ init_t38_info_conv(packet_info *pinfo)
        p_t38_conv = NULL;
 
        /* Use existing packet info if available */
-        p_t38_packet_conv = (t38_conv *)p_get_proto_data(wmem_file_scope(), pinfo, proto_t38, 0);
+       p_t38_packet_conv = (t38_conv *)p_get_proto_data(wmem_file_scope(), pinfo, proto_t38, 0);
 
 
        /* find the conversation used for Reassemble and Setup Info */
@@ -445,38 +445,38 @@ init_t38_info_conv(packet_info *pinfo)
                conversation_set_dissector(p_conv, t38_udp_handle);
        }
 
-       if (!p_t38_packet_conv) {
-               p_t38_conv = (t38_conv *)conversation_get_proto_data(p_conv, proto_t38);
-
-               /* create the conversation if it doen't exist */
-               if (!p_t38_conv) {
-                       p_t38_conv = wmem_new(wmem_file_scope(), t38_conv);
-                       p_t38_conv->setup_method[0] = '\0';
-                       p_t38_conv->setup_frame_number = 0;
-
-                       p_t38_conv->src_t38_info.reass_ID = 0;
-                       p_t38_conv->src_t38_info.reass_start_seqnum = -1;
-                       p_t38_conv->src_t38_info.reass_data_type = 0;
-                       p_t38_conv->src_t38_info.last_seqnum = -1;
-                       p_t38_conv->src_t38_info.packet_lost = 0;
-                       p_t38_conv->src_t38_info.burst_lost = 0;
-                       p_t38_conv->src_t38_info.time_first_t4_data = 0;
-                       p_t38_conv->src_t38_info.additional_hdlc_data_field_counter = 0;
-                       p_t38_conv->src_t38_info.seqnum_prev_data_field = -1;
-
-                       p_t38_conv->dst_t38_info.reass_ID = 0;
-                       p_t38_conv->dst_t38_info.reass_start_seqnum = -1;
-                       p_t38_conv->dst_t38_info.reass_data_type = 0;
-                       p_t38_conv->dst_t38_info.last_seqnum = -1;
-                       p_t38_conv->dst_t38_info.packet_lost = 0;
-                       p_t38_conv->dst_t38_info.burst_lost = 0;
-                       p_t38_conv->dst_t38_info.time_first_t4_data = 0;
-                       p_t38_conv->dst_t38_info.additional_hdlc_data_field_counter = 0;
-                       p_t38_conv->dst_t38_info.seqnum_prev_data_field = -1;
-
-                       conversation_add_proto_data(p_conv, proto_t38, p_t38_conv);
-               }
+       p_t38_conv = (t38_conv *)conversation_get_proto_data(p_conv, proto_t38);
+
+       /* create the conversation if it doesn't exist */
+       if (!p_t38_conv) {
+               p_t38_conv = wmem_new(wmem_file_scope(), t38_conv);
+               p_t38_conv->setup_method[0] = '\0';
+               p_t38_conv->setup_frame_number = 0;
+
+               p_t38_conv->src_t38_info.reass_ID = 0;
+               p_t38_conv->src_t38_info.reass_start_seqnum = -1;
+               p_t38_conv->src_t38_info.reass_data_type = 0;
+               p_t38_conv->src_t38_info.last_seqnum = -1;
+               p_t38_conv->src_t38_info.packet_lost = 0;
+               p_t38_conv->src_t38_info.burst_lost = 0;
+               p_t38_conv->src_t38_info.time_first_t4_data = 0;
+               p_t38_conv->src_t38_info.additional_hdlc_data_field_counter = 0;
+               p_t38_conv->src_t38_info.seqnum_prev_data_field = -1;
+
+               p_t38_conv->dst_t38_info.reass_ID = 0;
+               p_t38_conv->dst_t38_info.reass_start_seqnum = -1;
+               p_t38_conv->dst_t38_info.reass_data_type = 0;
+               p_t38_conv->dst_t38_info.last_seqnum = -1;
+               p_t38_conv->dst_t38_info.packet_lost = 0;
+               p_t38_conv->dst_t38_info.burst_lost = 0;
+               p_t38_conv->dst_t38_info.time_first_t4_data = 0;
+               p_t38_conv->dst_t38_info.additional_hdlc_data_field_counter = 0;
+               p_t38_conv->dst_t38_info.seqnum_prev_data_field = -1;
+
+               conversation_add_proto_data(p_conv, proto_t38, p_t38_conv);
+       }
 
+       if (!p_t38_packet_conv) {
                /* copy the t38 conversation info to the packet t38 conversation */
                p_t38_packet_conv = wmem_new(wmem_file_scope(), t38_conv);
                g_strlcpy(p_t38_packet_conv->setup_method, p_t38_conv->setup_method, MAX_T38_SETUP_METHOD_SIZE);
index ab472ff97f6cb1bd8b862a4afa5313318c1cc0f1..08676f72eff84b00bef8d5df42752700506e0e36 100644 (file)
@@ -1017,7 +1017,7 @@ init_t38_info_conv(packet_info *pinfo)
        p_t38_conv = NULL;
 
        /* Use existing packet info if available */
-        p_t38_packet_conv = (t38_conv *)p_get_proto_data(wmem_file_scope(), pinfo, proto_t38, 0);
+       p_t38_packet_conv = (t38_conv *)p_get_proto_data(wmem_file_scope(), pinfo, proto_t38, 0);
 
 
        /* find the conversation used for Reassemble and Setup Info */
@@ -1034,38 +1034,38 @@ init_t38_info_conv(packet_info *pinfo)
                conversation_set_dissector(p_conv, t38_udp_handle);
        }
 
-       if (!p_t38_packet_conv) {
-               p_t38_conv = (t38_conv *)conversation_get_proto_data(p_conv, proto_t38);
-
-               /* create the conversation if it doen't exist */
-               if (!p_t38_conv) {
-                       p_t38_conv = wmem_new(wmem_file_scope(), t38_conv);
-                       p_t38_conv->setup_method[0] = '\0';
-                       p_t38_conv->setup_frame_number = 0;
-
-                       p_t38_conv->src_t38_info.reass_ID = 0;
-                       p_t38_conv->src_t38_info.reass_start_seqnum = -1;
-                       p_t38_conv->src_t38_info.reass_data_type = 0;
-                       p_t38_conv->src_t38_info.last_seqnum = -1;
-                       p_t38_conv->src_t38_info.packet_lost = 0;
-                       p_t38_conv->src_t38_info.burst_lost = 0;
-                       p_t38_conv->src_t38_info.time_first_t4_data = 0;
-                       p_t38_conv->src_t38_info.additional_hdlc_data_field_counter = 0;
-                       p_t38_conv->src_t38_info.seqnum_prev_data_field = -1;
-
-                       p_t38_conv->dst_t38_info.reass_ID = 0;
-                       p_t38_conv->dst_t38_info.reass_start_seqnum = -1;
-                       p_t38_conv->dst_t38_info.reass_data_type = 0;
-                       p_t38_conv->dst_t38_info.last_seqnum = -1;
-                       p_t38_conv->dst_t38_info.packet_lost = 0;
-                       p_t38_conv->dst_t38_info.burst_lost = 0;
-                       p_t38_conv->dst_t38_info.time_first_t4_data = 0;
-                       p_t38_conv->dst_t38_info.additional_hdlc_data_field_counter = 0;
-                       p_t38_conv->dst_t38_info.seqnum_prev_data_field = -1;
-
-                       conversation_add_proto_data(p_conv, proto_t38, p_t38_conv);
-               }
+       p_t38_conv = (t38_conv *)conversation_get_proto_data(p_conv, proto_t38);
+
+       /* create the conversation if it doesn't exist */
+       if (!p_t38_conv) {
+               p_t38_conv = wmem_new(wmem_file_scope(), t38_conv);
+               p_t38_conv->setup_method[0] = '\0';
+               p_t38_conv->setup_frame_number = 0;
+
+               p_t38_conv->src_t38_info.reass_ID = 0;
+               p_t38_conv->src_t38_info.reass_start_seqnum = -1;
+               p_t38_conv->src_t38_info.reass_data_type = 0;
+               p_t38_conv->src_t38_info.last_seqnum = -1;
+               p_t38_conv->src_t38_info.packet_lost = 0;
+               p_t38_conv->src_t38_info.burst_lost = 0;
+               p_t38_conv->src_t38_info.time_first_t4_data = 0;
+               p_t38_conv->src_t38_info.additional_hdlc_data_field_counter = 0;
+               p_t38_conv->src_t38_info.seqnum_prev_data_field = -1;
+
+               p_t38_conv->dst_t38_info.reass_ID = 0;
+               p_t38_conv->dst_t38_info.reass_start_seqnum = -1;
+               p_t38_conv->dst_t38_info.reass_data_type = 0;
+               p_t38_conv->dst_t38_info.last_seqnum = -1;
+               p_t38_conv->dst_t38_info.packet_lost = 0;
+               p_t38_conv->dst_t38_info.burst_lost = 0;
+               p_t38_conv->dst_t38_info.time_first_t4_data = 0;
+               p_t38_conv->dst_t38_info.additional_hdlc_data_field_counter = 0;
+               p_t38_conv->dst_t38_info.seqnum_prev_data_field = -1;
+
+               conversation_add_proto_data(p_conv, proto_t38, p_t38_conv);
+       }
 
+       if (!p_t38_packet_conv) {
                /* copy the t38 conversation info to the packet t38 conversation */
                p_t38_packet_conv = wmem_new(wmem_file_scope(), t38_conv);
                g_strlcpy(p_t38_packet_conv->setup_method, p_t38_conv->setup_method, MAX_T38_SETUP_METHOD_SIZE);