summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTomas Mraz <tmraz@fedoraproject.org>2014-08-13 15:01:32 +0200
committerTomas Mraz <tmraz@fedoraproject.org>2014-08-13 15:01:32 +0200
commitdebe27335e10d06aa16a5ac2148fe8a74675ca2c (patch)
tree7639d092570f07d48e5aa19d04fa6e3a60aa8c13 /modules
parent8f7f6da06091153702f38e283d8f34778ccf9eb2 (diff)
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')
-rw-r--r--modules/pam_tally2/pam_tally2.c5
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';