mirror of git://sourceware.org/git/glibc.git
[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.
This commit is contained in:
parent
3cf449180c
commit
4bed549a22
|
|
@ -1,5 +1,11 @@
|
||||||
2008-10-31 Ulrich Drepper <drepper@redhat.com>
|
2008-10-31 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
[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.
|
||||||
|
|
||||||
[BZ #6995]
|
[BZ #6995]
|
||||||
* sysdeps/powerpc/powerpc32/dl-machine.c: Fix typo in message.
|
* sysdeps/powerpc/powerpc32/dl-machine.c: Fix typo in message.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
|
@ -23,6 +23,12 @@
|
||||||
int
|
int
|
||||||
__getgroups_chk (int size, __gid_t list[], size_t listlen)
|
__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))
|
if (__builtin_expect (size * sizeof (__gid_t) > listlen, 0))
|
||||||
__chk_fail ();
|
__chk_fail ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* Checking macros for unistd functions.
|
/* Checking macros for unistd functions.
|
||||||
Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
|
Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
|
@ -267,7 +267,7 @@ __NTH (getgroups (int __size, __gid_t __list[]))
|
||||||
{
|
{
|
||||||
if (__bos (__list) != (size_t) -1)
|
if (__bos (__list) != (size_t) -1)
|
||||||
{
|
{
|
||||||
if (!__builtin_constant_p (__size))
|
if (!__builtin_constant_p (__size) || __size < 0)
|
||||||
return __getgroups_chk (__size, __list, __bos (__list));
|
return __getgroups_chk (__size, __list, __bos (__list));
|
||||||
|
|
||||||
if (__size * sizeof (__gid_t) > __bos (__list))
|
if (__size * sizeof (__gid_t) > __bos (__list))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue