Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Dec 2012 08:54:53 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r244206 - stable/7/sys/kern
Message-ID:  <201212140854.qBE8srbu027383@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Fri Dec 14 08:54:52 2012
New Revision: 244206
URL: http://svnweb.freebsd.org/changeset/base/244206

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/7/sys/kern/kern_prot.c
Directory Properties:
  stable/7/sys/   (props changed)

Modified: stable/7/sys/kern/kern_prot.c
==============================================================================
--- stable/7/sys/kern/kern_prot.c	Fri Dec 14 08:53:25 2012	(r244205)
+++ stable/7/sys/kern/kern_prot.c	Fri Dec 14 08:54:52 2012	(r244206)
@@ -1937,6 +1937,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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212140854.qBE8srbu027383>