Kernel: Allow setgroups() to drop all groups with nullptr

Previously we'd EFAULT for setgroups(0, nullptr), but we can just as
well tolerate it if someone wants to drop groups without a pointer.
This commit is contained in:
Andreas Kling 2020-01-04 13:47:54 +01:00
parent 69af59d061
commit 5abc30e057
Notes: sideshowbarker 2024-07-19 10:22:32 +09:00

View file

@ -2270,7 +2270,7 @@ int Process::sys$setgroups(ssize_t count, const gid_t* gids)
return -EINVAL;
if (!is_superuser())
return -EPERM;
if (!validate_read(gids, count))
if (count && !validate_read(gids, count))
return -EFAULT;
m_extra_gids.clear();
for (int i = 0; i < count; ++i) {