988deb5815f57656f6cad7db5629449a277388b7
[openwrt/openwrt.git] / toolchain / fortify-headers / patches / 100-fix-getgroups.patch
1 From 1f9848efc8a329cb9a13323cbb94b353d39802c1 Mon Sep 17 00:00:00 2001
2 From: Steven Barth <steven@midlink.org>
3 Date: Mon, 22 Jun 2015 14:36:16 +0200
4 Subject: [PATCH] unistd: fix signed / unsigned comparison in getgroups
5
6 Signed-off-by: Steven Barth <steven@midlink.org>
7 ---
8 include/unistd.h | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11 diff --git a/include/unistd.h b/include/unistd.h
12 index 45304e1..5274e22 100644
13 --- a/include/unistd.h
14 +++ b/include/unistd.h
15 @@ -71,7 +71,7 @@ _FORTIFY_FN(getgroups) int getgroups(int __l, gid_t *__s)
16 {
17 size_t __b = __builtin_object_size(__s, 0);
18
19 - if (__l > __b / sizeof(gid_t))
20 + if (__l < 0 || (size_t)__l > __b / sizeof(gid_t))
21 __builtin_trap();
22 return __orig_getgroups(__l, __s);
23 }
24 --
25 2.1.4
26