mirror of
https://github.com/shadow-maint/shadow.git
synced 2026-01-26 14:03:17 +00:00
src/login.c: main(): Use login_name_max_size()
Instead of raw sysconf(_SC_LOGIN_NAME_MAX) calls, which was being used
without error handling.
Fixes: 3b7cc053872c ("lib: replace `USER_NAME_MAX_LENGTH` macro")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
parent
99df9d746e
commit
a6eb312f60
@ -27,6 +27,7 @@
|
||||
|
||||
#include "alloc.h"
|
||||
#include "attr.h"
|
||||
#include "chkname.h"
|
||||
#include "defines.h"
|
||||
#include "faillog.h"
|
||||
#include "failure.h"
|
||||
@ -573,8 +574,9 @@ int main (int argc, char **argv)
|
||||
}
|
||||
#ifdef RLOGIN
|
||||
if (rflg) {
|
||||
size_t max_size = sysconf(_SC_LOGIN_NAME_MAX);
|
||||
size_t max_size;
|
||||
|
||||
max_size = login_name_max_size();
|
||||
assert (NULL == username);
|
||||
username = XMALLOC(max_size, char);
|
||||
username[max_size - 1] = '\0';
|
||||
@ -882,8 +884,9 @@ int main (int argc, char **argv)
|
||||
|
||||
failed = false; /* haven't failed authentication yet */
|
||||
if (NULL == username) { /* need to get a login id */
|
||||
size_t max_size = sysconf(_SC_LOGIN_NAME_MAX);
|
||||
size_t max_size;
|
||||
|
||||
max_size = login_name_max_size();
|
||||
if (subroot) {
|
||||
closelog ();
|
||||
exit (1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user