diff options
Diffstat (limited to 'modules/pam_unix/support.c')
-rw-r--r-- | modules/pam_unix/support.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/pam_unix/support.c b/modules/pam_unix/support.c index 6b8b8020..9b6b19a2 100644 --- a/modules/pam_unix/support.c +++ b/modules/pam_unix/support.c @@ -123,9 +123,10 @@ char *PAM_getlogin(void) D(("PAM_getlogin ttyname: %s", curr_tty)); curr_tty += 5; setutent(); - strncpy(line.ut_line, curr_tty, sizeof line.ut_line); + strncpy(line.ut_line, curr_tty, sizeof(line.ut_line)); if ((ut = getutline(&line)) != NULL) { strncpy(curr_user, ut->ut_user, sizeof(ut->ut_user)); + curr_user[sizeof(curr_user) - 1] = '\0'; retval = curr_user; } endutent(); |