summaryrefslogtreecommitdiff
path: root/modules/pam_unix/unix_chkpwd.c
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2001-11-26 06:05:24 +0000
committerAndrew G. Morgan <morgan@kernel.org>2001-11-26 06:05:24 +0000
commitfc78bb8523d8d6a2c90ded155b555e956156c2b1 (patch)
tree78ea8b949cc2d3f5fb1e2eec3f671a556b2809a4 /modules/pam_unix/unix_chkpwd.c
parent820ef4f92f20eed02bee458cff35da22662a4631 (diff)
Relevant BUGIDs: 476947
Purpose of commit: cleanup Commit summary: --------------- be more confident that strings are being initialized correctly from Nalin.
Diffstat (limited to 'modules/pam_unix/unix_chkpwd.c')
-rw-r--r--modules/pam_unix/unix_chkpwd.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/pam_unix/unix_chkpwd.c b/modules/pam_unix/unix_chkpwd.c
index b0509e47..592ea5b3 100644
--- a/modules/pam_unix/unix_chkpwd.c
+++ b/modules/pam_unix/unix_chkpwd.c
@@ -172,9 +172,8 @@ static char *getuidname(uid_t uid)
if (pw == NULL)
return NULL;
- memset(username, 0, 32);
- strncpy(username, pw->pw_name, 32);
- username[31] = '\0';
+ strncpy(username, pw->pw_name, sizeof(username));
+ username[sizeof(username) - 1] = '\0';
return username;
}