summaryrefslogtreecommitdiff
path: root/modules/pam_unix/pam_unix_passwd.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/pam_unix_passwd.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/pam_unix_passwd.c')
-rw-r--r--modules/pam_unix/pam_unix_passwd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/pam_unix/pam_unix_passwd.c b/modules/pam_unix/pam_unix_passwd.c
index 7f8f6e03..7870f320 100644
--- a/modules/pam_unix/pam_unix_passwd.c
+++ b/modules/pam_unix/pam_unix_passwd.c
@@ -285,9 +285,11 @@ static int save_old_password(const char *forwho, const char *oldpass, int howman
}
pass = crypt_md5_wrapper(oldpass);
if (s_pas == NULL)
- sprintf(nbuf, "%s:%s:%d:%s\n", s_luser, s_uid, npas, pass);
+ snprintf(nbuf, sizeof(nbuf), "%s:%s:%d:%s\n",
+ s_luser, s_uid, npas, pass);
else
- sprintf(nbuf, "%s:%s:%d:%s,%s\n", s_luser, s_uid, npas, s_pas, pass);
+ snprintf(nbuf, sizeof(nbuf),"%s:%s:%d:%s,%s\n",
+ s_luser, s_uid, npas, s_pas, pass);
_pam_delete(pass);
if (fputs(nbuf, pwfile) < 0) {
retval = PAM_AUTHTOK_ERR;
@@ -309,7 +311,8 @@ static int save_old_password(const char *forwho, const char *oldpass, int howman
err = 1;
} else {
pass = crypt_md5_wrapper(oldpass);
- sprintf(nbuf, "%s:%d:1:%s\n", forwho, pwd->pw_uid, pass);
+ snprintf(nbuf, sizeof(nbuf), "%s:%d:1:%s\n",
+ forwho, pwd->pw_uid, pass);
_pam_delete(pass);
if (fputs(nbuf, pwfile) < 0) {
retval = PAM_AUTHTOK_ERR;