summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpyllyukko <pyllyukko@maimed.org>2022-01-12 15:33:13 +0200
committerGitHub <noreply@github.com>2022-01-12 14:33:13 +0100
commitd590cf5509c8aab41af13ed35cc00cc92513bd59 (patch)
treec105bb9c72fc9d7923ccdbdee14bbeea070580be
parent033bef86413afc0a0543e52dc8422282349d3520 (diff)
downloadlinux-pam-git-d590cf5509c8aab41af13ed35cc00cc92513bd59.tar.gz
Check the return value of localtime in faillock (#421)
-rw-r--r--modules/pam_faillock/main.c5
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"),