From 5abc30e0577832030aa45574d79727ba1c58b788 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 4 Jan 2020 13:47:54 +0100 Subject: [PATCH] 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. --- Kernel/Process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 62d5cccf0b..7d7af10da1 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -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) {