Description: Catch frames with a capture length bigger than the buffer Author: Christoph Biedl Bug: https://github.com/appneta/tcpreplay/issues/405 Last-Update: 2017-06-12 --- a/src/tcpcapinfo.c +++ b/src/tcpcapinfo.c @@ -306,6 +306,14 @@ last_usec = pcap_ph.ts.tv_usec; } + if (caplen > 10000) { + printf("\n\nCapture file appears to be damaged or corrupt.\n" + "Contains packet of size %u, bigger than buffer length %u\n", + caplen, 10000); + close(fd); + break; + } + /* read the frame */ maxread = min((size_t)caplen, sizeof(buf)); if ((ret = read(fd, &buf, maxread)) != maxread) {