Don't copy more than MAXLOGNAME bytes in getlogin() syscall,

it is stricter than padded s_login size check was there.
This commit is contained in:
Andrey A. Chernov 1997-03-03 22:46:16 +00:00
parent 0b7607eaaf
commit 30cf3ac460

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_prot.c 8.6 (Berkeley) 1/21/94 * @(#)kern_prot.c 8.6 (Berkeley) 1/21/94
* $Id: kern_prot.c,v 1.23 1997/02/22 09:39:09 peter Exp $ * $Id: kern_prot.c,v 1.24 1997/03/03 10:15:48 ache Exp $
*/ */
/* /*
@ -661,8 +661,8 @@ getlogin(p, uap, retval)
int *retval; int *retval;
{ {
if (uap->namelen > sizeof (p->p_pgrp->pg_session->s_login)) if (uap->namelen > MAXLOGNAME)
uap->namelen = sizeof (p->p_pgrp->pg_session->s_login); uap->namelen = MAXLOGNAME);
return (copyout((caddr_t) p->p_pgrp->pg_session->s_login, return (copyout((caddr_t) p->p_pgrp->pg_session->s_login,
(caddr_t) uap->namebuf, uap->namelen)); (caddr_t) uap->namebuf, uap->namelen));
} }