Skip to content

Commit

Permalink
Fix memory leak when reading group input.
Browse files Browse the repository at this point in the history
Since this occurs in a potentially endless loop, a malicious user could cause resource exhaustion.
  • Loading branch information
Martin Lambers committed Oct 17, 2024
1 parent 5401b77 commit 268a08e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/pam_weblogin.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, UNUSED int flags, int arg
}
char *group_input = tty_input(pamh, PROMPT_GROUP, PAM_PROMPT_ECHO_ON);
group = strtol(group_input, &end, 10);
free(group_input);
range_error = errno == ERANGE;
if (group < 1 || group > max_groups || range_error)
{
Expand Down

0 comments on commit 268a08e

Please sign in to comment.