100-fix-getgroups.patch 756 B

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