* src/lastlog.c, src/faillog.c: Fix underflows causing wrong entry

to be displayed.
This commit is contained in:
nekral-guest
2011-06-02 20:26:30 +00:00
parent f406d16b7b
commit 597bb764f1
3 changed files with 13 additions and 9 deletions

View File

@ -102,9 +102,8 @@ static void print_one (/*@null@*/const struct passwd *pw)
}
offset = pw->pw_uid * sizeof (ll);
if (offset <= (statbuf.st_size - sizeof (ll))) {
offset = (off_t) pw->pw_uid * sizeof (ll);
if (offset + sizeof (ll) <= statbuf.st_size) {
/* fseeko errors are not really relevant for us. */
int err = fseeko (lastlogfile, offset, SEEK_SET);
assert (0 == err);