diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2001-10-12 05:56:26 +0000 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2001-10-12 05:56:26 +0000 |
commit | 094652b733bf2422420213c4e87af920ff05e6f3 (patch) | |
tree | 79ebcda1d10d30a12bfacbaf3efe35f2f8e8e6ef /modules/pam_lastlog | |
parent | 64ab317e86dc8e798b4f4ed603227206c0fc001b (diff) | |
download | pam-094652b733bf2422420213c4e87af920ff05e6f3.tar.gz pam-094652b733bf2422420213c4e87af920ff05e6f3.tar.bz2 pam-094652b733bf2422420213c4e87af920ff05e6f3.zip |
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/pam_lastlog')
-rw-r--r-- | modules/pam_lastlog/pam_lastlog.c | 10 |
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")); |