Abort if given uname is > MAXLOGNAME-1
This commit is contained in:
Daniel O'Callaghan 1998-05-26 06:39:08 +00:00
parent 14d8151513
commit c6a24f8623
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=36391

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";
#endif
static const char rcsid[] =
"$Id: su.c,v 1.25 1997/10/28 21:20:21 guido Exp $";
"$Id: su.c,v 1.26 1998/05/25 03:34:52 steve Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -169,6 +169,11 @@ main(argc, argv)
break;
}
if (strlen(user) > MAXLOGNAME - 1) {
(void)fprintf(stderr, "su: username too long.\n");
exit(1);
}
if (user == NULL)
usage();