From ead640e9676fd74d1ea6bc9e88cff6897c75a951 Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 11 Apr 1998 20:31:46 +0000 Subject: setsockopt() transports user option data in an mbuf. if the user data is greater than MLEN, setsockopt is unable to pass it onto the protocol handler. Allocate a cluster in such case. PR: 2575 Reviewed by: phk Submitted by: Julian Assange proff@iq.org --- sys/kern/uipc_syscalls.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sys/kern/uipc_syscalls.c') diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 76470e9..c63ec40 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94 - * $Id: uipc_syscalls.c,v 1.36 1998/02/09 06:09:27 eivind Exp $ + * $Id: uipc_syscalls.c,v 1.37 1998/03/28 10:33:08 bde Exp $ */ #include "opt_compat.h" @@ -985,12 +985,17 @@ setsockopt(p, uap) error = getsock(p->p_fd, uap->s, &fp); if (error) return (error); - if (uap->valsize > MLEN) + if (uap->valsize > MCLBYTES) return (EINVAL); if (uap->val) { m = m_get(M_WAIT, MT_SOOPTS); if (m == NULL) return (ENOBUFS); + if (uap->valsize > MLEN) { + MCLGET(m, M_WAIT); + if(!(m->m_flags & M_EXT)) + return (ENOBUFS); + } error = copyin(uap->val, mtod(m, caddr_t), (u_int)uap->valsize); if (error) { (void) m_free(m); -- cgit v1.1