]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Fix chpasswd long line handling 158/head
authorNathan Ruiz <nathan.ruiz@cornerstonesolutions.com.au>
Fri, 16 Nov 2018 05:41:30 +0000 (16:41 +1100)
committerNathan Ruiz <nathan.ruiz@cornerstonesolutions.com.au>
Tue, 9 Apr 2019 21:56:59 +0000 (07:56 +1000)
src/chpasswd.c

index 49e79cdb6260ff1636d217d568e87747f0f0e5c9..d1c1043aaec2018e13c93d988a695f6763197c20 100644 (file)
@@ -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);