Commit 158d6fd
committed
Fix segfault when crypt() returns NULL
`crypt()` and `crypt_r()` can return `NULL` when an error is encountered.
For example, if a user has been locked using `usermod -L`, queries to the
password database can return an encrypted password prefixed by `!`, and
`crypt()` will return `NULL` because the password hash is malformed.
This change prevents `auth_password_compare_pwd()` from dereferencing
a NULL pointer if `crypt()` or `crypt_r()` returns NULL due to an error.
Instead, we now return nonzero in this case (i.e., authentication failed).1 parent db2933f commit 158d6fd
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
787 | 787 | | |
788 | 788 | | |
789 | 789 | | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
790 | 795 | | |
791 | 796 | | |
792 | 797 | | |
| |||
0 commit comments