Author: bapt Date: Fri Dec 14 08:52:08 2012 New Revision: 244204 URL: http://svnweb.freebsd.org/changeset/base/244204
Log: MFC r243021: return ERANGE if the buffer is too small to contain the login as documented in the manpage Reviewed by: cognet, kib Modified: stable/9/sys/kern/kern_prot.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_prot.c ============================================================================== --- stable/9/sys/kern/kern_prot.c Fri Dec 14 08:07:37 2012 (r244203) +++ stable/9/sys/kern/kern_prot.c Fri Dec 14 08:52:08 2012 (r244204) @@ -2084,6 +2084,8 @@ sys_getlogin(struct thread *td, struct g bcopy(p->p_session->s_login, login, uap->namelen); SESS_UNLOCK(p->p_session); PROC_UNLOCK(p); + if (strlen(login) + 1 > uap->namelen) + return (ERANGE); error = copyout(login, uap->namebuf, uap->namelen); return (error); } _______________________________________________ svn-src-stable-9@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9 To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"