From ca9c160933919a85cd22dfd1784dcc04675fb72a Mon Sep 17 00:00:00 2001 From: Hadriel Kaplan Date: Thu, 27 Mar 2014 17:24:20 -0400 Subject: Fix bug9931 'Encapsulated ethernet packets sometimes show invalid FCS' This fixes part-1 of bug9931: the uninitialized use of a wtap_pkthdr struct. The second part of the bug deals with dissectors calling the Ethernet dissector for ecnapsulated Ethernet packets but using the wrong dissector handle to do so. That's unrelated to the issue this commit addresses, so I'm splitting them up. Change-Id: I87be7b736f82dd74d8c261062f88143372b5344c Reviewed-on: https://code.wireshark.org/review/848 Reviewed-by: Hadriel Kaplan Reviewed-by: Anders Broman --- ui/tap_export_pdu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'ui/tap_export_pdu.c') diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c index 2191c40066..ec8c78130f 100644 --- a/ui/tap_export_pdu.c +++ b/ui/tap_export_pdu.c @@ -48,6 +48,7 @@ export_pdu_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, co int buffer_len; guint8 *packet_buf; + memset(&pkthdr, 0, sizeof(struct wtap_pkthdr)); buffer_len = exp_pdu_data->tvb_captured_length + exp_pdu_data->tlv_buffer_len; packet_buf = (guint8 *)g_malloc(buffer_len); @@ -64,13 +65,11 @@ export_pdu_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, co pkthdr.len = exp_pdu_data->tvb_reported_length + exp_pdu_data->tlv_buffer_len; pkthdr.pkt_encap = exp_pdu_tap_data->pkt_encap; - pkthdr.interface_id = 0; - pkthdr.presence_flags = 0; pkthdr.opt_comment = g_strdup(pinfo->pkt_comment); - pkthdr.drop_count = 0; - pkthdr.pack_flags = 0; pkthdr.presence_flags = WTAP_HAS_CAP_LEN|WTAP_HAS_INTERFACE_ID|WTAP_HAS_TS|WTAP_HAS_PACK_FLAGS; + /* XXX: should the pkthdr.pseudo_header be set to the pinfo's pseudo-header? */ + wtap_dump(exp_pdu_tap_data->wdh, &pkthdr, packet_buf, &err); g_free(packet_buf); -- cgit v1.2.3