diff options
| author | thorpej <thorpej@NetBSD.org> | 1997-06-26 05:56:38 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 1997-06-26 05:56:38 +0000 |
| commit | 01cbda9800a4e4b2638f2bdd7338d9e996e913ca (patch) | |
| tree | 24b07abb34dc69ce2d98714114efcaaa443bd1a1 /sys/kern | |
| parent | 73de3e34b8d22c1ffb430dcfab428a6eb2a95b26 (diff) | |
In sbappendaddr(), if the sockaddr length is larger than will fit in
an mbuf, allocate enough external storage to hold the sockaddr. Thanks
to enami tsugutomo <enami@cv.sony.co.jp> for providing sanity-checks.
Diffstat (limited to 'sys/kern')
| -rw-r--r-- | sys/kern/uipc_socket2.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index bc5feebe6a2..6594dd50470 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket2.c,v 1.19 1997/01/11 05:16:46 thorpej Exp $ */ +/* $NetBSD: uipc_socket2.c,v 1.20 1997/06/26 05:56:38 thorpej Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1990, 1993 @@ -598,11 +598,16 @@ panic("sbappendaddr"); } if (space > sbspace(sb)) return (0); - if (asa->sa_len > MLEN) - return (0); MGET(m, M_DONTWAIT, MT_SONAME); if (m == 0) return (0); + if (asa->sa_len > MLEN) { + MEXTMALLOC(m, asa->sa_len, M_NOWAIT); + if ((m->m_flags & M_EXT) == 0) { + m_free(m); + return (0); + } + } m->m_len = asa->sa_len; bcopy((caddr_t)asa, mtod(m, caddr_t), asa->sa_len); if (n) |
