* lib/defines.h: Define USER_NAME_MAX_LENGTH, based on utmp and
default to 32. * libmisc/chkname.c: Use USER_NAME_MAX_LENGTH. * src/login.c: Use USER_NAME_MAX_LENGTH instead of the default 32. username also needs to be bigger than USER_NAME_MAX_LENGTH because it has to be nul-terminated.
This commit is contained in:
10
src/login.c
10
src/login.c
@@ -610,8 +610,9 @@ int main (int argc, char **argv)
|
||||
}
|
||||
#ifdef RLOGIN
|
||||
if (rflg) {
|
||||
username = xmalloc (32 * sizeof (char));
|
||||
if (do_rlogin (hostname, username, 32, term, sizeof term)) {
|
||||
username = xmalloc (USER_NAME_MAX_LENGTH + 1);
|
||||
username[USER_NAME_MAX_LENGTH] = '\0';
|
||||
if (do_rlogin (hostname, username, USER_NAME_MAX_LENGTH, term, sizeof term)) {
|
||||
preauth_flag = true;
|
||||
} else {
|
||||
free (username);
|
||||
@@ -920,8 +921,9 @@ int main (int argc, char **argv)
|
||||
exit (1);
|
||||
}
|
||||
preauth_flag = false;
|
||||
username = xmalloc (32);
|
||||
login_prompt (_("\n%s login: "), username, 32);
|
||||
username = xmalloc (USER_NAME_MAX_LENGTH + 1);
|
||||
username[USER_NAME_MAX_LENGTH] = '\0';
|
||||
login_prompt (_("\n%s login: "), username, USER_NAME_MAX_LENGTH);
|
||||
|
||||
if ('\0' == username) {
|
||||
/* Prompt for a new login */
|
||||
|
||||
Reference in New Issue
Block a user