diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2008-05-06 07:18:10 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2008-05-06 07:18:10 +0000 |
commit | d22cf34709f2dfbeb48bf0ca67355fe34e027b0e (patch) | |
tree | 4e2ab60c9f509bdf74edf14abadaf83765e090a7 /sys/net | |
parent | b04779acb0d7f4ae3a8dd44489f89e833a660684 (diff) |
M_PREPEND can set its first parameter to NULL, and all other code
using M_PREPEND checks for NULL after the invocation. So check
here too and return ENOBUFS if NULL is detected.
ok henning@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_tun.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 98872dbc3ca..390a1b16ae3 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.91 2007/12/20 02:53:02 brad Exp $ */ +/* $OpenBSD: if_tun.c,v 1.92 2008/05/06 07:18:09 krw Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -551,6 +551,8 @@ tun_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, return (ether_output(ifp, m0, dst, rt)); M_PREPEND(m0, sizeof(*af), M_DONTWAIT); + if (m0 == NULL) + return (ENOBUFS); af = mtod(m0, u_int32_t *); *af = htonl(dst->sa_family); |