summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-03-15 11:48:10 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-03-15 11:48:10 +0000
commit5626858a6440777cf915a7e298961973ac2accef (patch)
treee5f39b47ca21b7b60bd77ccb8d6c67fb418e5c88
parentd0264fee37411062e3aff8c4f01c033cf55e799f (diff)
m_prepend() works only for sizes smaller than MHLEN.
OK beck@ deraadt@ pyr@
-rw-r--r--sys/kern/uipc_mbuf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 1496a8d6442..0074b8f63a0 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.79 2006/12/29 13:04:37 pedro Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.80 2007/03/15 11:48:09 claudio Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -221,6 +221,9 @@ m_prepend(struct mbuf *m, int len, int how)
{
struct mbuf *mn;
+ if (len > MHLEN)
+ panic("mbuf prepend length too big");
+
MGET(mn, how, m->m_type);
if (mn == NULL) {
m_freem(m);
@@ -230,8 +233,7 @@ m_prepend(struct mbuf *m, int len, int how)
M_MOVE_PKTHDR(mn, m);
mn->m_next = m;
m = mn;
- if (len < MHLEN)
- MH_ALIGN(m, len);
+ MH_ALIGN(m, len);
m->m_len = len;
return (m);
}