From: Nathan Ruiz Date: Fri, 16 Nov 2018 05:41:30 +0000 (+1100) Subject: Fix chpasswd long line handling X-Git-Tag: 4.7~14^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F158%2Fhead;p=thirdparty%2Fshadow.git Fix chpasswd long line handling --- diff --git a/src/chpasswd.c b/src/chpasswd.c index 49e79cdb6..d1c1043aa 100644 --- a/src/chpasswd.c +++ b/src/chpasswd.c @@ -432,6 +432,15 @@ int main (int argc, char **argv) *cp = '\0'; } else { 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, _("%s: line %d: line too long\n"), Prog, line);