summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Mraz <tmraz@fedoraproject.org>2014-08-05 16:26:01 +0200
committerTomas Mraz <tmraz@fedoraproject.org>2014-08-05 16:26:01 +0200
commit8731716646adc8065b45dc59b5e9ca1893d5a495 (patch)
tree44f5d362d2e0b8c7c5f73ce3b72eaadc50f1a888
parentd65f138fbc784911399e5afe66c9661e0136b43d (diff)
pam_lastlog: Properly clean up last_login structure before use.
modules/pam_lastlog/pam_lastlog.c (last_login_write): Properly clean up last_login structure before use.
-rw-r--r--modules/pam_lastlog/pam_lastlog.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/pam_lastlog/pam_lastlog.c b/modules/pam_lastlog/pam_lastlog.c
index ad8c6605..50d33e40 100644
--- a/modules/pam_lastlog/pam_lastlog.c
+++ b/modules/pam_lastlog/pam_lastlog.c
@@ -350,6 +350,8 @@ last_login_write(pam_handle_t *pamh, int announce, int last_fd,
return PAM_SERVICE_ERR;
}
+ memset(&last_login, 0, sizeof(last_login));
+
/* set this login date */
D(("set the most recent login time"));
(void) time(&ll_time); /* set the time */
@@ -364,14 +366,12 @@ last_login_write(pam_handle_t *pamh, int announce, int last_fd,
}
/* copy to last_login */
- last_login.ll_host[0] = '\0';
strncat(last_login.ll_host, remote_host, sizeof(last_login.ll_host)-1);
/* set the terminal line */
terminal_line = get_tty(pamh);
/* copy to last_login */
- last_login.ll_line[0] = '\0';
strncat(last_login.ll_line, terminal_line, sizeof(last_login.ll_line)-1);
terminal_line = NULL;