commit 8731716646adc8065b45dc59b5e9ca1893d5a495
Author: Tomas Mraz <tmraz(a)fedoraproject.org>
Date: Tue Aug 5 16:26:01 2014 +0200
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.
modules/pam_lastlog/pam_lastlog.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/modules/pam_lastlog/pam_lastlog.c b/modules/pam_lastlog/pam_lastlog.c
index ad8c660..50d33e4 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;
Show replies by thread