libpam: make /etc/passwd checks 8 bit clean

libpam/pam_modutil_check_user.c: explicitly convert the character
read from /etc/passwd to type "char" to get the same signedness
as the one compared with. Otherwise the functionality will depend
on the (implementation defined) signedness of "char" on the
platform built for.
This commit is contained in:
Göran Uddeborg 2024-05-13 15:12:36 +02:00
parent 99888b2566
commit 55a20554f9

View File

@ -51,7 +51,7 @@ pam_modutil_check_user_in_passwd(pam_handle_t *pamh,
*/
for (p = user_name; *p != '\0'; p++) {
c = fgetc(fp);
if (c == EOF || c == '\n' || c != *p)
if (c == EOF || c == '\n' || (char)c != *p)
break;
}