enforce-maxpacket.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. Subject: tcprewrite: Handle frames of 65535 octets size
  2. ID: CVE-2016-6160
  3. Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
  4. Date: Mon Jun 29 17:08:24 2015 +0200
  5. Bug-Debian: https://bugs.debian.org/829350
  6. Last-Update: 2016-07-06
  7. diff --git a/src/defines.h.in b/src/defines.h.in
  8. index 3a1bf1e..5468d14 100644
  9. --- a/src/defines.h.in
  10. +++ b/src/defines.h.in
  11. @@ -104,7 +104,7 @@ typedef struct tcpr_speed_s tcpr_speed_t;
  12. #define DEFAULT_MTU 1500 /* Max Transmission Unit of standard ethernet
  13. * don't forget *frames* are MTU + L2 header! */
  14. -#define MAXPACKET 65535 /* was 16436 linux loopback, but maybe something is bigger then
  15. +#define MAXPACKET 65549 /* was 16436 linux loopback, but maybe something is bigger then
  16. linux loopback */
  17. #define MAX_SNAPLEN 65535 /* tell libpcap to capture the entire packet */
  18. diff --git a/src/tcprewrite.c b/src/tcprewrite.c
  19. index 90a6f2e..9c32a5e 100644
  20. --- a/src/tcprewrite.c
  21. +++ b/src/tcprewrite.c
  22. @@ -253,6 +253,8 @@ rewrite_packets(tcpedit_t *tcpedit, pcap_t *pin, pcap_dumper_t *pout)
  23. packetnum++;
  24. dbgx(2, "packet " COUNTER_SPEC " caplen %d", packetnum, pkthdr.caplen);
  25. + if (pkthdr.caplen > MAXPACKET)
  26. + errx(-1, "Frame too big, caplen %d exceeds %d", pkthdr.caplen, MAXPACKET);
  27. /*
  28. * copy over the packet so we can pad it out if necessary and
  29. * because pcap_next() returns a const ptr