From fc78bb8523d8d6a2c90ded155b555e956156c2b1 Mon Sep 17 00:00:00 2001 From: "Andrew G. Morgan" Date: Mon, 26 Nov 2001 06:05:24 +0000 Subject: Relevant BUGIDs: 476947 Purpose of commit: cleanup Commit summary: --------------- be more confident that strings are being initialized correctly from Nalin. --- modules/pam_unix/unix_chkpwd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'modules/pam_unix/unix_chkpwd.c') 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; } -- cgit v1.2.3