svn commit: r244205 - stable/8/sys/kern

Baptiste Daroussin bapt at FreeBSD.org
Fri Dec 14 08:53:25 UTC 2012


Author: bapt
Date: Fri Dec 14 08:53:25 2012
New Revision: 244205
URL: http://svnweb.freebsd.org/changeset/base/244205

Log:
  MRC r243021:
  
  return ERANGE if the buffer is too small to contain the login as documented in
  the manpage
  
  Reviewed by:	cognet, kib

Modified:
  stable/8/sys/kern/kern_prot.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)

Modified: stable/8/sys/kern/kern_prot.c
==============================================================================
--- stable/8/sys/kern/kern_prot.c	Fri Dec 14 08:52:08 2012	(r244204)
+++ stable/8/sys/kern/kern_prot.c	Fri Dec 14 08:53:25 2012	(r244205)
@@ -2065,6 +2065,8 @@ getlogin(struct thread *td, struct getlo
 	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);
 }


More information about the svn-src-stable mailing list