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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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

_______________________________________________
Pam-list mailing list
Pam-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/pam-list




[Index of Archives]     [Fedora Users]     [Kernel]     [Red Hat Install]     [Linux for the blind]     [Gimp]

  Powered by Linux