]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Fix segfault when time is unreadable
authored@s5h.net <ed@s5h.net>
Sat, 7 Mar 2020 16:49:17 +0000 (16:49 +0000)
committered <ed@s5h.net>
Sat, 7 Mar 2020 17:08:19 +0000 (17:08 +0000)
Adding myself to contributors

Closes #130

README
src/faillog.c

diff --git a/README b/README
index c0c03f2d8c9e6b345ec2ed6a6611da524a3a433f..cf54ca8e3ee23d850f973807bcbac1d764b5b7f5 100644 (file)
--- a/README
+++ b/README
@@ -59,6 +59,7 @@ Dave Hagewood <admin@arrowweb.com>
 David A. Holland <dholland@hcs.harvard.edu>
 David Frey <David.Frey@lugs.ch>
 Ed Carp <ecarp@netcom.com>
+Ed Neville <ed@s5h.net>
 Eric W. Biederman" <ebiederm@xmission.com>
 Floody <flood@evcom.net>
 Frank Denis <j@4u.net>
index 1309dad4f0b89831d6b42054208780a7a580fee0..3ab48db36d914a4c6ad5795130443fc6eb15c349 100644 (file)
@@ -163,6 +163,10 @@ static void print_one (/*@null@*/const struct passwd *pw, bool force)
        }
 
        tm = localtime (&fl.fail_time);
+       if (!tm) {
+               fprintf (stderr, "Cannot read time from faillog.\n");
+               exit (EXIT_FAILURE);
+       }
 #ifdef HAVE_STRFTIME
        strftime (ptime, sizeof (ptime), "%D %H:%M:%S %z", tm);
        cp = ptime;