mirror of
https://github.com/qemu/qemu.git
synced 2024-11-25 20:03:37 +08:00
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> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5266 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
e856f2ad01
commit
cb3bc23361
@ -5247,6 +5247,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
|
||||
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 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user