diff options
author | ume <ume@FreeBSD.org> | 2004-06-07 09:59:50 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2004-06-07 09:59:50 +0000 |
commit | 3a5bdeaf2c085bc2783baa831f373d758a5fe9c8 (patch) | |
tree | 4f24ff0b1b427499d8e33b04b411e4740440b8c3 /sys/kern | |
parent | 4ef088056e761c4db372fe0ae25a21f4c0d9d04b (diff) | |
download | FreeBSD-src-3a5bdeaf2c085bc2783baa831f373d758a5fe9c8.zip FreeBSD-src-3a5bdeaf2c085bc2783baa831f373d758a5fe9c8.tar.gz |
allow more than MLEN bytes for ancillary data to meet the
requirement of Section 20.1 of RFC3542.
Obtained from: KAME
MFC after: 1 week
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_syscalls.c | 10 |
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) |