diff --git a/src/pam_weblogin.c b/src/pam_weblogin.c index 64fccec..6dc6dbc 100644 --- a/src/pam_weblogin.c +++ b/src/pam_weblogin.c @@ -233,7 +233,13 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, UNUSED int flags, int arg tty_output(pamh, str_printf(" [%d] %s", i+1, name)); } char *group_input = tty_input(pamh, PROMPT_GROUP, PAM_PROMPT_ECHO_ON); - group = strtol(group_input, &end, 10); + if (!group_input) + { + errno = ERANGE; /* treat no input as invalid input */ + } else + { + group = strtol(group_input, &end, 10); + } free(group_input); range_error = errno == ERANGE; if (group < 1 || group > max_groups || range_error)