diff options
author | 2016-10-11 11:40:12 +0000 | |
---|---|---|
committer | 2016-10-11 11:40:12 +0000 | |
commit | 8749b40c739fda7f38625a3083e7bb38cf15f638 (patch) | |
tree | 8e7734e01ac7561034f7e4b1430bf5d0c9625f73 | |
parent | Support double and triple clicks (they are cumulative, so double is (diff) | |
download | wireguard-openbsd-8749b40c739fda7f38625a3083e7bb38cf15f638.tar.xz wireguard-openbsd-8749b40c739fda7f38625a3083e7bb38cf15f638.zip |
Strengthen Ethernet packet length checks on input; ok dlg
-rw-r--r-- | sys/net/if_ethersubr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 185c23e2f6b..56376f2020c 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.240 2016/10/10 02:44:17 dlg Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.241 2016/10/11 11:40:12 mikeb Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -319,6 +319,10 @@ ether_input(struct ifnet *ifp, struct mbuf *m, void *cookie) struct ether_header *eh_tmp; #endif + /* Drop short frames */ + if (m->m_len < ETHER_HDR_LEN) + goto dropanyway; + ac = (struct arpcom *)ifp; eh = mtod(m, struct ether_header *); m_adj(m, ETHER_HDR_LEN); @@ -435,7 +439,8 @@ decapsulate: return (1); #endif default: - if (llcfound || etype > ETHERMTU) + if (llcfound || etype > ETHERMTU || + m->m_len < sizeof(struct llc)) goto dropanyway; llcfound = 1; l = mtod(m, struct llc *); |