qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [5266] Fix getgroups() with zero size parameter (Kirill Shu


From: Andrzej Zaborowski
Subject: [Qemu-devel] [5266] Fix getgroups() with zero size parameter (Kirill Shutemov).
Date: Sat, 20 Sep 2008 02:08:14 +0000

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 <address@hidden>

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) {






reply via email to

[Prev in Thread] Current Thread [Next in Thread]