diff options
author | Tomas Mraz <tmraz@fedoraproject.org> | 2014-08-13 15:01:32 +0200 |
---|---|---|
committer | Tomas Mraz <tmraz@fedoraproject.org> | 2014-08-13 15:01:32 +0200 |
commit | debe27335e10d06aa16a5ac2148fe8a74675ca2c (patch) | |
tree | 7639d092570f07d48e5aa19d04fa6e3a60aa8c13 /modules/pam_tally2 | |
parent | 8f7f6da06091153702f38e283d8f34778ccf9eb2 (diff) | |
download | pam-debe27335e10d06aa16a5ac2148fe8a74675ca2c.tar.gz pam-debe27335e10d06aa16a5ac2148fe8a74675ca2c.tar.bz2 pam-debe27335e10d06aa16a5ac2148fe8a74675ca2c.zip |
pam_tally2: Avoid uninitialized use of fileinfo.
Problem found by Robin Hack <rhack@redhat.com>.
modules/pam_tally2/pam_tally2.c (get_tally): Do not depend on file size
just try to read it.
Diffstat (limited to 'modules/pam_tally2')
-rw-r--r-- | modules/pam_tally2/pam_tally2.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/modules/pam_tally2/pam_tally2.c b/modules/pam_tally2/pam_tally2.c index 09e85855..f5eebb10 100644 --- a/modules/pam_tally2/pam_tally2.c +++ b/modules/pam_tally2/pam_tally2.c @@ -451,11 +451,8 @@ skip_open: alarm(oldalarm); } - if (fileinfo.st_size < (off_t)(uid+1)*(off_t)sizeof(*tally)) { + if (pam_modutil_read(*tfile, void_tally, sizeof(*tally)) != sizeof(*tally)) { memset(tally, 0, sizeof(*tally)); - } else if (pam_modutil_read(*tfile, void_tally, sizeof(*tally)) != sizeof(*tally)) { - memset(tally, 0, sizeof(*tally)); - /* Shouldn't happen */ } tally->fail_line[sizeof(tally->fail_line)-1] = '\0'; |