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>
#include "alloc.h"
#include "attr.h"
+#include "chkname.h"
#include "defines.h"
#include "faillog.h"
#include "failure.h"
}
#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';
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);