From d5c01cfd6e47503fb597c5568f43cdf079a30719 Mon Sep 17 00:00:00 2001 From: Christian Göttsche Date: Thu, 4 Jan 2024 18:24:05 +0100 Subject: pam_unix: clean additional possible sensitive buffers --- modules/pam_unix/pam_unix_passwd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/pam_unix/pam_unix_passwd.c') diff --git a/modules/pam_unix/pam_unix_passwd.c b/modules/pam_unix/pam_unix_passwd.c index 3a223949..b915ce66 100644 --- a/modules/pam_unix/pam_unix_passwd.c +++ b/modules/pam_unix/pam_unix_passwd.c @@ -350,7 +350,7 @@ static int check_old_password(const char *forwho, const char *newpass) if (opwfile == NULL) return PAM_ABORT; - while (getline(&buf, &n, opwfile) != -1) { + for (; getline(&buf, &n, opwfile) != -1; pam_overwrite_n(buf, n)) { if (!strncmp(buf, forwho, len) && (buf[len] == ':' || buf[len] == ',')) { char *sptr; @@ -372,6 +372,7 @@ static int check_old_password(const char *forwho, const char *newpass) break; } } + pam_overwrite_n(buf, n); free(buf); fclose(opwfile); -- cgit v1.2.3