Merge pull request #229 from edneville/130_segfaults_on_strftime

Fix segfault on strftime
This commit is contained in:
Serge Hallyn 2020-03-09 13:17:11 -05:00 committed by GitHub
commit 3f2bbcfa91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

1
README
View File

@ -59,6 +59,7 @@ Dave Hagewood <admin@arrowweb.com>
David A. Holland <dholland@hcs.harvard.edu> David A. Holland <dholland@hcs.harvard.edu>
David Frey <David.Frey@lugs.ch> David Frey <David.Frey@lugs.ch>
Ed Carp <ecarp@netcom.com> Ed Carp <ecarp@netcom.com>
Ed Neville <ed@s5h.net>
Eric W. Biederman" <ebiederm@xmission.com> Eric W. Biederman" <ebiederm@xmission.com>
Floody <flood@evcom.net> Floody <flood@evcom.net>
Frank Denis <j@4u.net> Frank Denis <j@4u.net>

View File

@ -163,6 +163,10 @@ static void print_one (/*@null@*/const struct passwd *pw, bool force)
} }
tm = localtime (&fl.fail_time); tm = localtime (&fl.fail_time);
if (!tm) {
fprintf (stderr, "Cannot read time from faillog.\n");
return;
}
#ifdef HAVE_STRFTIME #ifdef HAVE_STRFTIME
strftime (ptime, sizeof (ptime), "%D %H:%M:%S %z", tm); strftime (ptime, sizeof (ptime), "%D %H:%M:%S %z", tm);
cp = ptime; cp = ptime;