From: Lionel Sambuc Date: Tue, 28 May 2013 19:08:15 +0000 (+0000) Subject: servers/pm: Fix EFAULT check for SETGROUPS X-Git-Tag: v3.3.0~956 X-Git-Url: http://zhaoyanbai.com/repos/rndc.html?a=commitdiff_plain;h=refs%2Fchanges%2F97%2F597%2F1;p=minix.git servers/pm: Fix EFAULT check for SETGROUPS The previous test would return EFAULT as soon as the group pointer was NULL, while it is sensible when the count is also 0. In that case, the SETGROUP syscall is expected to clear all the group entries as the new set is empty. Change-Id: I07b7e1d1f023a52e3035d53f7d9b42b660e039e8 --- diff --git a/servers/pm/getset.c b/servers/pm/getset.c index 407a5a63a..9084b4e76 100644 --- a/servers/pm/getset.c +++ b/servers/pm/getset.c @@ -141,7 +141,7 @@ int do_set() if (ngroups > NGROUPS_MAX || ngroups < 0) return(EINVAL); - if (m_in.groupsp == NULL) + if (m_in.grp_no > 0 && m_in.groupsp == NULL) return(EFAULT); r = sys_datacopy(who_e, (vir_bytes) m_in.groupsp, SELF,