diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1998-11-25 02:01:29 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1998-11-25 02:01:29 +0000 |
commit | df0457dc198642163b2ac78650e8a965f86aae27 (patch) | |
tree | 0377953b1f02bbe170d979bfd6f03702aaca03a9 /sys/netinet/ip_ah_old.c | |
parent | 9eace93090ecd5af22f4c9832c2e581cca6fd70f (diff) |
Add checks of packets getting to big after transforms.
Also make sure some more error conditions get told to the caller.
Diffstat (limited to 'sys/netinet/ip_ah_old.c')
-rw-r--r-- | sys/netinet/ip_ah_old.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/netinet/ip_ah_old.c b/sys/netinet/ip_ah_old.c index 2b4bd0d3fb1..25f5883c055 100644 --- a/sys/netinet/ip_ah_old.c +++ b/sys/netinet/ip_ah_old.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah_old.c,v 1.15 1998/06/03 09:50:19 provos Exp $ */ +/* $OpenBSD: ip_ah_old.c,v 1.16 1998/11/25 02:01:26 niklas Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -473,7 +473,7 @@ ah_old_output(struct mbuf *m, struct sockaddr_encap *gw, struct tdb *tdb, DPRINTF(("ah_old_output(): m_pullup() failed, SA &x/%08x\n", tdb->tdb_dst, ntohl(tdb->tdb_spi))); ahstat.ahs_hdrops++; - return NULL; + return ENOBUFS; } ip = mtod(m, struct ip *); @@ -488,6 +488,15 @@ ah_old_output(struct mbuf *m, struct sockaddr_encap *gw, struct tdb *tdb, ilen = ntohs(ip->ip_len); ohlen = AH_OLD_FLENGTH + alen; + if (ohlen + ilen > IP_MAXPACKET) { + if (encdebug) + log(LOG_ALERT, + "ah_old_output(): packet in SA %x/%0x8 got too big\n", + tdb->tdb_dst, ntohl(tdb->tdb_spi)); + m_freem(m); + ahstat.ahs_toobig++; + return ENOBUFS; + } ipo.ip_v = IPVERSION; ipo.ip_hl = ip->ip_hl; |