From: Guy Harris Date: Mon, 3 Oct 2016 06:58:40 +0000 (-0700) Subject: Check for the "break the loop" condition in the inner loop for TPACKET_V3. X-Git-Tag: libpcap-1.8.1~13 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/abe6d6dd6ba3e0405dc78c50378d4f112456ef34 Check for the "break the loop" condition in the inner loop for TPACKET_V3. Otherwise, if a callback calls pcap_breakloop(), the inner loop won't terminate. --- diff --git a/pcap-linux.c b/pcap-linux.c index b51f5e50..924df42a 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -5093,7 +5093,7 @@ again: packets_to_read = max_packets - pkts; } - while (packets_to_read--) { + while (packets_to_read-- && !handle->break_loop) { struct tpacket3_hdr* tp3_hdr = (struct tpacket3_hdr*) handlep->current_packet; ret = pcap_handle_packet_mmap( handle,