summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2001-10-12 05:56:26 +0000
committerAndrew G. Morgan <morgan@kernel.org>2001-10-12 05:56:26 +0000
commit094652b733bf2422420213c4e87af920ff05e6f3 (patch)
tree79ebcda1d10d30a12bfacbaf3efe35f2f8e8e6ef /modules
parent64ab317e86dc8e798b4f4ed603227206c0fc001b (diff)
Relevant BUGIDs: 436060
Purpose of commit: paranoia fix Commit summary: --------------- Remove possibility of an un-nul terminated string. (Patch from Red Hat release courtesy of Harald Welte.)
Diffstat (limited to 'modules')
-rw-r--r--modules/pam_lastlog/pam_lastlog.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/pam_lastlog/pam_lastlog.c b/modules/pam_lastlog/pam_lastlog.c
index 15f83c83..c86becd8 100644
--- a/modules/pam_lastlog/pam_lastlog.c
+++ b/modules/pam_lastlog/pam_lastlog.c
@@ -334,8 +334,9 @@ static int last_login_date(pam_handle_t *pamh, int announce, uid_t uid)
}
/* copy to last_login */
- strncpy(last_login.ll_host, remote_host
- , sizeof(last_login.ll_host));
+ strncpy(last_login.ll_host, remote_host,
+ sizeof(last_login.ll_host));
+ last_login.ll_host[sizeof(last_login.ll_host) - 1] = '\0';
remote_host = NULL;
/* set the terminal line */
@@ -350,8 +351,9 @@ static int last_login_date(pam_handle_t *pamh, int announce, uid_t uid)
D(("terminal = %s", terminal_line));
/* copy to last_login */
- strncpy(last_login.ll_line, terminal_line
- , sizeof(last_login.ll_line));
+ strncpy(last_login.ll_line, terminal_line,
+ sizeof(last_login.ll_line));
+ last_login.ll_host[sizeof(last_login.ll_host) - 1] = '\0';
terminal_line = NULL;
D(("locking last_log file"));