fortify-headers

standalone fortify-source implementation
git clone git://git.2f30.org/fortify-headers
Log | Files | Refs | README | LICENSE

commit e71d1fd257717987239380f52c25026e634c6a81
parent de499b92ba1539dde59a8f788807950229d03897
Author: sin <sin@2f30.org>
Date:   Sat, 28 Feb 2015 20:49:00 +0000

Remove redundant checks

We can never have an array of more than SIZE_MAX/2/sizeof(gid_t)
gid_t's.

Diffstat:
Minclude/poll.h | 2+-
Minclude/unistd.h | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/poll.h b/include/poll.h @@ -11,7 +11,7 @@ __fortify_poll(struct pollfd *fds, nfds_t nfds, int timeout) { __typeof__(sizeof 0) bos = __builtin_object_size(fds, 0); - if (bos != -1 && nfds > bos / sizeof(struct pollfd)) + if (nfds > bos / sizeof(struct pollfd)) __builtin_trap(); return poll(fds, nfds, timeout); } diff --git a/include/unistd.h b/include/unistd.h @@ -46,7 +46,7 @@ __fortify_getgroups(int len, gid_t *set) { size_t bos = __builtin_object_size(set, 0); - if (bos != -1 && len > bos / sizeof(gid_t)) + if (len > bos / sizeof(gid_t)) __builtin_trap(); return getgroups(len, set); }