Date: Wed, 18 May 2016 22:05:50 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300168 - in head/sys: kern sys Message-ID: <201605182205.u4IM5okP048113@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Wed May 18 22:05:50 2016 New Revision: 300168 URL: https://svnweb.freebsd.org/changeset/base/300168 Log: 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 Modified: head/sys/kern/uipc_syscalls.c head/sys/sys/socketvar.h Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Wed May 18 22:02:19 2016 (r300167) +++ head/sys/kern/uipc_syscalls.c Wed May 18 22:05:50 2016 (r300168) @@ -84,6 +84,7 @@ static int getsockname1(struct thread *t 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 { Modified: head/sys/sys/socketvar.h ============================================================================== --- head/sys/sys/socketvar.h Wed May 18 22:02:19 2016 (r300167) +++ head/sys/sys/socketvar.h Wed May 18 22:05:50 2016 (r300168) @@ -335,7 +335,6 @@ struct uio; /* * From uipc_socket and friends */ -int sockargs(struct mbuf **mp, caddr_t buf, int buflen, int type); int getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len); int getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp, struct file **fpp, u_int *fflagp);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605182205.u4IM5okP048113>