diff options
author | John Thacker <johnthacker@gmail.com> | 2021-11-21 09:14:42 -0500 |
---|---|---|
committer | John Thacker <johnthacker@gmail.com> | 2021-11-21 09:23:07 -0500 |
commit | ca71d1624cfb97a06e96d7c22239fdd677d666ec (patch) | |
tree | f2ac4f600258797275959406599b2d37ebd27c30 /plugins/epan | |
parent | abf9ed5f111d39acb7bbb9d943e7f2a5de4974ac (diff) |
gryphon: Create pkt_info if it doesn't exist
Try to retrieve the per packet info data first, and create it if
it doesn't exist, rather than assuming it is there on the second
pass. Prevents segfaults in cases with strange TCP sequence issues
(that still show up as bugs in the TCP dissector.) Fix #17737.
Diffstat (limited to 'plugins/epan')
-rw-r--r-- | plugins/epan/gryphon/packet-gryphon.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/epan/gryphon/packet-gryphon.c b/plugins/epan/gryphon/packet-gryphon.c index 49afe5664e..7da38456c1 100644 --- a/plugins/epan/gryphon/packet-gryphon.c +++ b/plugins/epan/gryphon/packet-gryphon.c @@ -3711,7 +3711,9 @@ decode_command(tvbuff_t *tvb, packet_info* pinfo, int msglen, int offset, int ds if (cmd > 0x3F) cmd += dst * 256; - if (!pinfo->fd->visited) { + pkt_info = (gryphon_pkt_info_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb)); + + if (!pkt_info) { /* Find a conversation, create a new if no one exists */ gryphon_conversation *conv_data = get_conversation_data(pinfo); @@ -3725,8 +3727,6 @@ decode_command(tvbuff_t *tvb, packet_info* pinfo, int msglen, int offset, int ds wmem_list_prepend(conv_data->request_frame_data, pkt_info); p_add_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb), pkt_info); - } else { - pkt_info = (gryphon_pkt_info_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb)); } proto_tree_add_uint(pt, hf_gryphon_command, tvb, offset, 1, cmd); @@ -3974,7 +3974,9 @@ decode_response(tvbuff_t *tvb, packet_info* pinfo, int offset, int src, proto_tr if (cmd > 0x3F) cmd += src * 256; - if (!pinfo->fd->visited) { + pkt_info = (gryphon_pkt_info_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb)); + + if (!pkt_info) { /* Find a conversation, create a new if no one exists */ gryphon_conversation *conv_data = get_conversation_data(pinfo); @@ -3999,9 +4001,6 @@ decode_response(tvbuff_t *tvb, packet_info* pinfo, int offset, int src, proto_tr p_add_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb), pkt_info); } - else { - pkt_info = (gryphon_pkt_info_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb)); - } /* this is the old original way of displaying */ proto_tree_add_uint(pt, hf_gryphon_command, tvb, offset, 1, cmd); |