diff options
author | pyllyukko <pyllyukko@maimed.org> | 2022-01-12 15:33:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-12 14:33:13 +0100 |
commit | d590cf5509c8aab41af13ed35cc00cc92513bd59 (patch) | |
tree | c105bb9c72fc9d7923ccdbdee14bbeea070580be /modules/pam_faillock/main.c | |
parent | 033bef86413afc0a0543e52dc8422282349d3520 (diff) | |
download | pam-d590cf5509c8aab41af13ed35cc00cc92513bd59.tar.gz pam-d590cf5509c8aab41af13ed35cc00cc92513bd59.tar.bz2 pam-d590cf5509c8aab41af13ed35cc00cc92513bd59.zip |
Check the return value of localtime in faillock (#421)
Diffstat (limited to 'modules/pam_faillock/main.c')
-rw-r--r-- | modules/pam_faillock/main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/pam_faillock/main.c b/modules/pam_faillock/main.c index f62e1bb2..ea6329ca 100644 --- a/modules/pam_faillock/main.c +++ b/modules/pam_faillock/main.c @@ -174,6 +174,11 @@ do_user(struct options *opts, const char *user) time_t when = tallies.records[i].time; tm = localtime(&when); + if(tm == NULL) { + fprintf(stderr, "%s: Invalid timestamp in the tally record\n", + opts->progname); + continue; + } strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm); printf("%-19s %-5s %-52.52s %s\n", timebuf, status & TALLY_STATUS_RHOST ? "RHOST" : (status & TALLY_STATUS_TTY ? "TTY" : "SVC"), |