Skip to content

Commit

Permalink
Fix memory leak when reading group input. (#101)
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.

Co-authored-by: Martin Lambers <[email protected]>
  • Loading branch information
marlam and Martin Lambers authored Oct 18, 2024
1 parent 68fcf22 commit 5e8705d
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 5e8705d

Please sign in to comment.