Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet/ip_input.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/netinet/ip_input.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.257 retrieving revision 1.258 diff -u -p -r1.257 -r1.258 --- src/sys/netinet/ip_input.c 2007/12/20 19:53:32 1.257 +++ src/sys/netinet/ip_input.c 2007/12/21 18:58:55 1.258 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.257 2007/12/20 19:53:32 dyoung Exp $ */ +/* $NetBSD: ip_input.c,v 1.258 2007/12/21 18:58:55 matt Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -98,7 +98,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.257 2007/12/20 19:53:32 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.258 2007/12/21 18:58:55 matt Exp $"); #include "opt_inet.h" #include "opt_gateway.h" @@ -896,7 +896,17 @@ ours: * but it's not worth the time; just let them time out.) */ if (ip->ip_off & ~htons(IP_DF|IP_RF)) { - + uint16_t off; + /* + * Prevent TCP blind data attacks by not allowing non-initial + * fragments to start at less than 68 bytes (minimal fragment + * size). + */ + off = htons(ip->ip_off) & ~(IP_DF|IP_EF|IP_MF); + if (off > 0 && off + hlen < IP_MINFRAGSIZE - 1) { + ipstat.ips_badfrags++; + goto bad; + } /* * Look for queue of fragments * of this datagram.