return ERANGE if the buffer is too small to contain the login as documented in
the manpage Reviewed by: cognet, kib MFC after: 1 month
This commit is contained in:
parent
23454ad0e2
commit
6f68699fbd
@ -2084,6 +2084,8 @@ sys_getlogin(struct thread *td, struct getlogin_args *uap)
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user