diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-10-31 14:27:36 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-10-31 14:27:36 +0000 |
commit | 4bed549a2277f911397ca59189ae71f79750f400 (patch) | |
tree | 0aac6faff2726fd62a37eb9c1844b930cc1c43b7 /debug | |
parent | 3cf449180c18bee7e1c8374a6583cb11d4a39ca7 (diff) | |
download | glibc-4bed549a2277f911397ca59189ae71f79750f400.tar.gz glibc-4bed549a2277f911397ca59189ae71f79750f400.tar.xz glibc-4bed549a2277f911397ca59189ae71f79750f400.zip |
[BZ #6980]
* debug/getgroups_chk.c (__getgroups_chk): Return EINVAL error for negative sizees. * posix/bits/unistd.h (getgroups): Call __getgroups_chk for negative __size.
Diffstat (limited to 'debug')
-rw-r--r-- | debug/getgroups_chk.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/debug/getgroups_chk.c b/debug/getgroups_chk.c index c877ddb9ca..8c3d99da7e 100644 --- a/debug/getgroups_chk.c +++ b/debug/getgroups_chk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,6 +23,12 @@ int __getgroups_chk (int size, __gid_t list[], size_t listlen) { + if (__builtin_expect (size < 0, 0)) + { + __set_errno (EINVAL); + return -1; + } + if (__builtin_expect (size * sizeof (__gid_t) > listlen, 0)) __chk_fail (); |