Merge pull request #158 from nathanruiz/master

Fix chpasswd long line handling
This commit is contained in:
Serge Hallyn 2019-04-21 16:50:07 -05:00 committed by GitHub
commit fe87a1ad96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -432,6 +432,15 @@ int main (int argc, char **argv)
*cp = '\0'; *cp = '\0';
} else { } else {
if (feof (stdin) == 0) { if (feof (stdin) == 0) {
// Drop all remaining characters on this line.
while (fgets (buf, (int) sizeof buf, stdin) != (char *) 0) {
cp = strchr (buf, '\n');
if (cp != NULL) {
break;
}
}
fprintf (stderr, fprintf (stderr,
_("%s: line %d: line too long\n"), _("%s: line %d: line too long\n"),
Prog, line); Prog, line);