Merge pull request #433 from stoeckmann/hushed
Handle malformed lines in hushlogins file.
This commit is contained in:
commit
1ff0b37134
@ -90,7 +90,7 @@ bool hushed (const char *username)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (found = false; !found && (fgets (buf, (int) sizeof buf, fp) == buf);) {
|
for (found = false; !found && (fgets (buf, (int) sizeof buf, fp) == buf);) {
|
||||||
buf[strlen (buf) - 1] = '\0';
|
buf[strcspn (buf, "\n")] = '\0';
|
||||||
found = (strcmp (buf, pw->pw_shell) == 0) ||
|
found = (strcmp (buf, pw->pw_shell) == 0) ||
|
||||||
(strcmp (buf, pw->pw_name) == 0);
|
(strcmp (buf, pw->pw_name) == 0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user