X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/16782c7e7811c2bc821c1f58ae948af7bccf81fe..f6fb59b11d20222d4648cdceeaadf6ce971a7a9a:/pcap-netfilter-linux.c diff --git a/pcap-netfilter-linux.c b/pcap-netfilter-linux.c index d9550b02..33204a54 100644 --- a/pcap-netfilter-linux.c +++ b/pcap-netfilter-linux.c @@ -136,6 +136,13 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c bp = (unsigned char *)handle->buffer; } else bp = handle->bp; + + /* + * Loop through each message. + * + * This assumes that a single buffer of message will have + * <= INT_MAX packets, so the message count doesn't overflow. + */ ep = bp + len; while (bp < ep) { const struct nlmsghdr *nlh = (const struct nlmsghdr *) bp;