From a8f713211361f84009772c1f2a86ce58cfe96b14 Mon Sep 17 00:00:00 2001 From: Nathan Ruiz Date: Fri, 16 Nov 2018 16:41:30 +1100 Subject: [PATCH] Fix chpasswd long line handling --- src/chpasswd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/chpasswd.c b/src/chpasswd.c index 49e79cdb..d1c1043a 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);