diff options
author | glebius <glebius@FreeBSD.org> | 2016-05-18 22:05:50 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2016-05-18 22:05:50 +0000 |
commit | 047e60c94a85e1381cd4e18c9e845ec34d5164a9 (patch) | |
tree | 3f76688ddbda6f8cb29cc61543f90736218a543c /sys/kern | |
parent | e971b15ccd4503351ac2deaedfd723240baf4dd5 (diff) | |
download | FreeBSD-src-047e60c94a85e1381cd4e18c9e845ec34d5164a9.zip FreeBSD-src-047e60c94a85e1381cd4e18c9e845ec34d5164a9.tar.gz |
The SA-16:19 wouldn't have happened if the sockargs() had properly typed
argument for length. While here make it static and convert to ANSI C.
Reviewed by: C Turt
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_syscalls.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 7184e47..75044eb 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -84,6 +84,7 @@ static int getsockname1(struct thread *td, struct getsockname_args *uap, int compat); static int getpeername1(struct thread *td, struct getpeername_args *uap, int compat); +static int sockargs(struct mbuf **, char *, socklen_t, int); /* * Convert a user file descriptor to a kernel file entry and check if required @@ -1689,19 +1690,13 @@ ogetpeername(td, uap) } #endif /* COMPAT_OLDSOCK */ -int -sockargs(mp, buf, buflen, type) - struct mbuf **mp; - caddr_t buf; - int buflen, type; +static int +sockargs(struct mbuf **mp, char *buf, socklen_t buflen, int type) { struct sockaddr *sa; struct mbuf *m; int error; - if (buflen < 0) - return (EINVAL); - if (buflen > MLEN) { #ifdef COMPAT_OLDSOCK if (type == MT_SONAME && buflen <= 112) @@ -1713,7 +1708,7 @@ sockargs(mp, buf, buflen, type) } m = m_get2(buflen, M_WAITOK, type, 0); m->m_len = buflen; - error = copyin(buf, mtod(m, caddr_t), (u_int)buflen); + error = copyin(buf, mtod(m, void *), buflen); if (error != 0) (void) m_free(m); else { |