diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-02-08 16:19:12 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-02-09 00:29:51 +0000 |
commit | 1f5f63f8ef98bfe9c4d734674cee0df64855555d (patch) | |
tree | 133dd3563cc8d2d29dd85d4d43cd9a4636283192 /tools/oss-fuzzshark | |
parent | e4c5efafb7da2d25b7d47fe2dac3b1556c0b67b0 (diff) |
Generalize wtap_pkthdr into a structure for packet and non-packet records.
Separate the stuff that any record could have from the stuff that only
particular record types have; put the latter into a union, and put all
that into a wtap_rec structure.
Add some record-type checks as necessary.
Change-Id: Id6b3486858f826fce4b096c59231f463e44bfaa2
Reviewed-on: https://code.wireshark.org/review/25696
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tools/oss-fuzzshark')
-rw-r--r-- | tools/oss-fuzzshark/fuzzshark.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/oss-fuzzshark/fuzzshark.c b/tools/oss-fuzzshark/fuzzshark.c index 79caada80d..6c4bc3cfe5 100644 --- a/tools/oss-fuzzshark/fuzzshark.c +++ b/tools/oss-fuzzshark/fuzzshark.c @@ -285,22 +285,22 @@ LLVMFuzzerTestOneInput(const guint8 *buf, size_t real_len) guint32 len = (guint32) real_len; - struct wtap_pkthdr whdr; + wtap_rec rec; frame_data fdlocal; - memset(&whdr, 0, sizeof(whdr)); + memset(&rec, 0, sizeof(rec)); - whdr.rec_type = REC_TYPE_PACKET; - whdr.caplen = len; - whdr.len = len; + rec.rec_type = REC_TYPE_PACKET; + rec.rec_header.packet_header.caplen = len; + rec.rec_header.packet_header.len = len; /* whdr.pkt_encap = WTAP_ENCAP_ETHERNET; */ - whdr.pkt_encap = G_MAXINT16; - whdr.presence_flags = WTAP_HAS_TS | WTAP_HAS_CAP_LEN; /* most common flags... */ + rec.rec_header.packet_header.pkt_encap = G_MAXINT16; + rec.presence_flags = WTAP_HAS_TS | WTAP_HAS_CAP_LEN; /* most common flags... */ - frame_data_init(&fdlocal, ++framenum, &whdr, /* offset */ 0, /* cum_bytes */ 0); + frame_data_init(&fdlocal, ++framenum, &rec, /* offset */ 0, /* cum_bytes */ 0); /* frame_data_set_before_dissect() not needed */ - epan_dissect_run(edt, WTAP_FILE_TYPE_SUBTYPE_UNKNOWN, &whdr, tvb_new_real_data(buf, len, len), &fdlocal, NULL /* &fuzz_cinfo */); + epan_dissect_run(edt, WTAP_FILE_TYPE_SUBTYPE_UNKNOWN, &rec, tvb_new_real_data(buf, len, len), &fdlocal, NULL /* &fuzz_cinfo */); frame_data_destroy(&fdlocal); epan_dissect_reset(edt); |