[PATCH 2/4] pam_tally2: Fix unitialized use of fileinfo.st_size.

Robin Hack rhack at redhat.com
Wed Aug 13 12:26:35 UTC 2014


---
 modules/pam_tally2/pam_tally2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/pam_tally2/pam_tally2.c b/modules/pam_tally2/pam_tally2.c
index 09e8585..ba0781f 100644
--- a/modules/pam_tally2/pam_tally2.c
+++ b/modules/pam_tally2/pam_tally2.c
@@ -368,6 +368,12 @@ get_tally(pam_handle_t *pamh, uid_t uid, const char *filename,
 
     if (*tfile != -1) {
 	preopened = 1;
+    lstat_ret = fstat(*tfile, &fileinfo);
+    if (lstat_ret == -1) {
+      /* If file is preopened, don't close file descriptor. */
+      pam_syslog(pamh, LOG_ALERT, "Couldn't stat %s", filename);
+      return PAM_AUTH_ERR;
+    }
 	goto skip_open;
     }
 
-- 
1.9.3




More information about the Pam-list mailing list