]> git.ipfire.org Git - thirdparty/util-linux.git/commit
tailf: Fix previously adjusted segfault patch
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 16 Jul 2016 10:51:42 +0000 (12:51 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 10 Aug 2016 11:08:47 +0000 (13:08 +0200)
commitd9208580d0b70dbdc67e18d6bd191e70e4ccf361
tree0c196bdc1870571f39d08cd55ef3c65804bba744
parentb3c5bc5c061b26971eb59619ee505d20120a77aa
tailf: Fix previously adjusted segfault patch

Casting the value to be checked to size_t renders the check useless.
If st_size is SIZE_MAX+1, it will be truncated to 0 and the check
succeeds. In fact, this check can never be false because every value
stored in a size_t is smaller or equal to SIZE_MAX.

I think this adjustment was meant to fix a compiler warning for 64 bit
systems for which sizeof(off_t) is sizeof(size_t), but the signedness
differs.

Going unconditionally to the greatest possible unsigned int type if
st_size is positive (off_t is signed) will fix this issue.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
text-utils/tailf.c