aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Certner <olce@FreeBSD.org>2025-08-28 16:58:53 +0000
committerOlivier Certner <olce@FreeBSD.org>2025-09-17 12:16:04 +0000
commitbbdea7c9f4aeae26b35f842382df0203fcda24a5 (patch)
tree6b27895453e16ed03076ef2e09fc44090bb44b6d
parenta207833f4fed5431cac853c082fa34dc8f33cba6 (diff)
linux: setgroups(): Fix the group number's upper limit
'ngroups_max' is the maximum number of supplementary groups the system will accept, and this has not changed. Fixes: 9da2fe96ff2e ("kern: fix setgroups(2) and getgroups(2) to match other platforms") MFC after: 5 days MFC to: stable/15 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52277
-rw-r--r--sys/compat/linux/linux_misc.c2
-rw-r--r--sys/compat/linux/linux_uid16.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 755eae057406..fb86de6e7302 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1034,7 +1034,7 @@ linux_setgroups(struct thread *td, struct linux_setgroups_args *args)
int error;
struct proc *p;
- if (ngrp < 0 || ngrp >= ngroups_max)
+ if (ngrp < 0 || ngrp > ngroups_max)
return (EINVAL);
linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK);
error = copyin(args->grouplist, linux_gidset, ngrp * sizeof(l_gid_t));
diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c
index 07430f5b399b..dd681f971746 100644
--- a/sys/compat/linux/linux_uid16.c
+++ b/sys/compat/linux/linux_uid16.c
@@ -91,7 +91,7 @@ linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args)
int error;
struct proc *p;
- if (ngrp < 0 || ngrp >= ngroups_max)
+ if (ngrp < 0 || ngrp > ngroups_max)
return (EINVAL);
linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK);
error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t));