Make username size dependant on MAXLOGNAME in sys/param.h. Was

previously hard-coded at 16 characters (and possibly overflowing
the field when NUL terminating a username of exactly 16 characters
in length).
This commit is contained in:
David Nugent 1997-02-02 14:43:32 +00:00
parent 65d758c4cb
commit 635b1c4908

View File

@ -93,7 +93,7 @@ struct termios tmode, omode;
int crmod, digit, lower, upper;
char hostname[MAXHOSTNAMELEN];
char name[16];
char name[MAXLOGNAME+1];
char dev[] = _PATH_DEV;
char ttyn[32];
@ -533,7 +533,7 @@ getname()
if (c == EOT || c == CTRL('d'))
exit(1);
if (c == '\r' || c == '\n' || np >= &name[sizeof name]) {
if (c == '\r' || c == '\n' || np >= &name[sizeof name-1]) {
putf("\r\n");
break;
}