unistd: fix signed / unsigned comparison in getgroups

Signed-off-by: Steven Barth <steven@midlink.org>
This commit is contained in:
Steven Barth 2015-06-22 14:36:16 +02:00 committed by sin
parent 8ff214efe6
commit 0825063aa6

View File

@ -71,7 +71,7 @@ _FORTIFY_FN(getgroups) int getgroups(int __l, gid_t *__s)
{
size_t __b = __builtin_object_size(__s, 0);
if (__l > __b / sizeof(gid_t))
if (__l < 0 || (size_t)__l > __b / sizeof(gid_t))
__builtin_trap();
return __orig_getgroups(__l, __s);
}