From c0aad886bad7374a4990db32cfc2cda78a77bf75 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 9 Nov 2018 19:03:07 -0800 Subject: [PATCH] capture_loop_write_pcapng_cb() shouldn't be called if use_pcapng is false. If it *is* called when global_capture_opts.use_pcapng is false, don't just silently drop the packet on the floor, abort. Change-Id: Idb8f8e4c4ba231cfe674a81da34bf46e00f8247c Reviewed-on: https://code.wireshark.org/review/30562 Reviewed-by: Guy Harris --- dumpcap.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dumpcap.c b/dumpcap.c index ceeca8c82d..23fe8b03f0 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -4191,9 +4191,11 @@ capture_loop_write_pcapng_cb(capture_src *pcap_src, const struct pcapng_block_he { int err; - if (!global_capture_opts.use_pcapng) { - return; - } + /* + * This should never be called if we're not writing pcapng. + */ + g_assert(global_capture_opts.use_pcapng); + /* We may be called multiple times from pcap_dispatch(); if we've set the "stop capturing" flag, ignore this packet, as we're not supposed to be saving any more packets. */