diff options
-rw-r--r-- | file.c | 2 | ||||
-rw-r--r-- | frame_tvbuff.c | 2 | ||||
-rw-r--r-- | proto_hier_stats.c | 2 | ||||
-rw-r--r-- | reordercap.c | 2 | ||||
-rw-r--r-- | tshark.c | 2 | ||||
-rw-r--r-- | ui/gtk/packet_list_store.c | 2 | ||||
-rw-r--r-- | ui/qt/packet_list_model.cpp | 2 | ||||
-rw-r--r-- | ui/tap_export_pdu.c | 7 | ||||
-rw-r--r-- | ui/text_import.c | 7 |
9 files changed, 18 insertions, 10 deletions
@@ -4019,7 +4019,7 @@ cf_get_comment(capture_file *cf, const frame_data *fd) struct wtap_pkthdr phdr; /* Packet header */ Buffer buf; /* Packet data */ - phdr.opt_comment = NULL; + memset(&phdr, 0, sizeof(struct wtap_pkthdr)); buffer_init(&buf, 1500); if (!cf_read_frame_r(cf, fd, &phdr, &buf)) diff --git a/frame_tvbuff.c b/frame_tvbuff.c index 74a40e2030..b47d206f07 100644 --- a/frame_tvbuff.c +++ b/frame_tvbuff.c @@ -74,6 +74,8 @@ frame_cache(struct tvb_frame *frame_tvb) { struct wtap_pkthdr phdr; /* Packet header */ + memset(&phdr, 0, sizeof(struct wtap_pkthdr)); + if (frame_tvb->buf == NULL) { frame_tvb->buf = (struct Buffer *) g_malloc(sizeof(struct Buffer)); diff --git a/proto_hier_stats.c b/proto_hier_stats.c index 1296f47c4d..68eaaa1eac 100644 --- a/proto_hier_stats.c +++ b/proto_hier_stats.c @@ -143,6 +143,8 @@ process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps) Buffer buf; double cur_time; + memset(&phdr, 0, sizeof(struct wtap_pkthdr)); + /* Load the frame from the capture file */ buffer_init(&buf, 1500); if (!cf_read_frame_r(&cfile, frame, &phdr, &buf)) diff --git a/reordercap.c b/reordercap.c index 2587afe098..4b363b84b1 100644 --- a/reordercap.c +++ b/reordercap.c @@ -96,6 +96,8 @@ frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh, Buffer *buf, gchar *err_info; struct wtap_pkthdr phdr; + memset(&phdr, 0, sizeof(struct wtap_pkthdr)); + DEBUG_PRINT("\nDumping frame (offset=%" G_GINT64_MODIFIER "u)\n", frame->offset); @@ -3064,6 +3064,8 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, Buffer buf; epan_dissect_t *edt = NULL; + memset(&phdr, 0, sizeof(struct wtap_pkthdr)); + shb_hdr = wtap_file_get_shb_info(cf->wth); idb_inf = wtap_file_get_idb_info(cf->wth); #ifdef PCAP_NG_DEFAULT diff --git a/ui/gtk/packet_list_store.c b/ui/gtk/packet_list_store.c index df2002dbc1..abcab70475 100644 --- a/ui/gtk/packet_list_store.c +++ b/ui/gtk/packet_list_store.c @@ -1102,6 +1102,8 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord * g_return_if_fail(packet_list); g_return_if_fail(PACKETLIST_IS_LIST(packet_list)); + memset(&phdr, 0, sizeof(struct wtap_pkthdr)); + fdata = record->fdata; if (dissect_columns) { diff --git a/ui/qt/packet_list_model.cpp b/ui/qt/packet_list_model.cpp index 14b88c9b80..a6b68f51bd 100644 --- a/ui/qt/packet_list_model.cpp +++ b/ui/qt/packet_list_model.cpp @@ -218,6 +218,8 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const else cinfo = NULL; + memset(&phdr, 0, sizeof(struct wtap_pkthdr)); + buffer_init(&buf, 1500); if (!cap_file_ || !cf_read_frame_r(cap_file_, fdata, &phdr, &buf)) { /* 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); diff --git a/ui/text_import.c b/ui/text_import.c index c1cfcf53ae..05fcc25b8f 100644 --- a/ui/text_import.c +++ b/ui/text_import.c @@ -520,16 +520,13 @@ write_current_packet (void) struct wtap_pkthdr pkthdr; int err; + memset(&pkthdr, 0, sizeof(struct wtap_pkthdr)); + pkthdr.ts.secs = (guint32)ts_sec; pkthdr.ts.nsecs = ts_usec * 1000; if (ts_fmt == NULL) { ts_usec++; } /* fake packet counter */ pkthdr.caplen = pkthdr.len = prefix_length + curr_offset + eth_trailer_length; pkthdr.pkt_encap = pcap_link_type; - pkthdr.interface_id = 0; - pkthdr.presence_flags = 0; - pkthdr.opt_comment = NULL; - pkthdr.drop_count = 0; - pkthdr.pack_flags = 0; pkthdr.pack_flags |= direction; pkthdr.presence_flags = WTAP_HAS_CAP_LEN|WTAP_HAS_INTERFACE_ID|WTAP_HAS_TS|WTAP_HAS_PACK_FLAGS; |