* [Qemu-devel] [5266] Fix getgroups() with zero size parameter (Kirill Shutemov).
@ 2008-09-20 2:08 Andrzej Zaborowski
0 siblings, 0 replies; only message in thread
From: Andrzej Zaborowski @ 2008-09-20 2:08 UTC (permalink / raw)
To: qemu-devel
Revision: 5266
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5266
Author: balrog
Date: 2008-09-20 02:08:13 +0000 (Sat, 20 Sep 2008)
Log Message:
-----------
Fix getgroups() with zero size parameter (Kirill Shutemov).
According to man page getgroups(2):
If size is zero, list is not modified, but the total number of
supplementary group IDs for the process is returned.
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Modified Paths:
--------------
trunk/linux-user/syscall.c
Modified: trunk/linux-user/syscall.c
===================================================================
--- trunk/linux-user/syscall.c 2008-09-20 01:32:07 UTC (rev 5265)
+++ trunk/linux-user/syscall.c 2008-09-20 02:08:13 UTC (rev 5266)
@@ -5247,6 +5247,8 @@
grouplist = alloca(gidsetsize * sizeof(gid_t));
ret = get_errno(getgroups(gidsetsize, grouplist));
+ if (gidsetsize == 0)
+ break;
if (!is_error(ret)) {
target_grouplist = lock_user(VERIFY_WRITE, arg2, gidsetsize * 2, 0);
if (!target_grouplist)
@@ -5397,6 +5399,8 @@
grouplist = alloca(gidsetsize * sizeof(gid_t));
ret = get_errno(getgroups(gidsetsize, grouplist));
+ if (gidsetsize == 0)
+ break;
if (!is_error(ret)) {
target_grouplist = lock_user(VERIFY_WRITE, arg2, gidsetsize * 4, 0);
if (!target_grouplist) {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-09-20 2:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-20 2:08 [Qemu-devel] [5266] Fix getgroups() with zero size parameter (Kirill Shutemov) Andrzej Zaborowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).