]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap-netfilter-linux.c
Make sure no read routine process more than INT_MAX packets.
[libpcap] / pcap-netfilter-linux.c
index d9550b02d399792b514eef51b3dbcdefa03da16d..33204a54e045bed86b69928f586cfb9c1ca66b10 100644 (file)
@@ -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;