Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#278 fail if capture has a packet that is too large #286

Merged
merged 2 commits into from
Feb 27, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
#278 fail if capture has a packet that is too large
  • Loading branch information
fklassen committed Feb 27, 2017
commit 04f1fc9755ed21a765e54bb1be0cad94b0c7c6b8
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