summaryrefslogtreecommitdiff
path: root/sys/net/if_tun.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-01-11 12:51:34 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-01-11 12:51:34 +0000
commit52a3a34a7ab8524a2a3c10d2199979b2b8bc5029 (patch)
tree5609e6d49ac566a0a388559d7c66e8adb5b7fc53 /sys/net/if_tun.c
parenta3b5cf64d48ccab0a01bb4949793d633850797e6 (diff)
Do not use m_adj() on empty mbufs (m->m_len is uninitialised), instead bump
m->m_data directly. This fixes the tun(4) / bridge(4) crash reported in PR4963. OK djm@ mpf@ markus@
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r--sys/net/if_tun.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index d308eff5038..0b4b7176573 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.73 2005/11/29 02:59:42 jolan Exp $ */
+/* $OpenBSD: if_tun.c,v 1.74 2006/01/11 12:51:33 claudio Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -837,7 +837,7 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag)
* this is neccessary for all strict aligned architectures.
*/
mlen -= ETHER_ALIGN;
- m_adj(m, ETHER_ALIGN);
+ m->m_data += ETHER_ALIGN;
}
while (error == 0 && uio->uio_resid > 0) {
m->m_len = min(mlen, uio->uio_resid);