summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/uipc_syscalls.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index e2206a4..8d54cae 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1574,11 +1574,19 @@ sockargs(mp, buf, buflen, type)
buflen = MLEN; /* unix domain compat. hack */
else
#endif
- return (EINVAL);
+ if ((u_int)buflen > MCLBYTES)
+ return (EINVAL);
}
m = m_get(M_TRYWAIT, type);
if (m == NULL)
return (ENOBUFS);
+ if ((u_int)buflen > MLEN) {
+ MCLGET(m, M_TRYWAIT);
+ if ((m->m_flags & M_EXT) == 0) {
+ m_free(m);
+ return (ENOBUFS);
+ }
+ }
m->m_len = buflen;
error = copyin(buf, mtod(m, caddr_t), (u_int)buflen);
if (error)
OpenPOWER on IntegriCloud