Skip to content

Commit

Permalink
#278 fail if capture has a packet that is too large (#286)
Browse files Browse the repository at this point in the history
* #278 fail if capture has a packet that is too large

* Update CHANGELOG
  • Loading branch information
fklassen authored Feb 27, 2017
1 parent 2c7ea1d commit d689d14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
02/26/2017 Version 4.2.0beta1
- tcpcapinfo buffer overflow vulnerablily (#278)
- Update git-clone instructions by Kyle McDonald (#277)
- Add protection against packet drift by Guillaume Scott (#268)
- Include Travis-CI build support by Ilya Shipitsin (#264) (#285)
Expand Down
11 changes: 10 additions & 1 deletion src/tcpcapinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,15 @@ main(int argc, char *argv[])
caplen = pcap_ph.caplen;
}

if (caplentoobig) {
printf("\n\nCapture file appears to be damaged or corrupt.\n"
"Contains packet of size %u, bigger than snap length %u\n",
caplen, pcap_fh.snaplen);

close(fd);
break;
}

/* check to make sure timestamps don't go backwards */
if (last_sec > 0 && last_usec > 0) {
if ((pcap_ph.ts.tv_sec == last_sec) ?
Expand All @@ -306,7 +315,7 @@ main(int argc, char *argv[])
}

close(fd);
continue;
break;
}

/* print the frame checksum */
Expand Down

0 comments on commit d689d14

Please sign in to comment.