Page MenuHomeFreeBSD

D51660.id159517.diff
No OneTemporary

D51660.id159517.diff

diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -2827,7 +2827,14 @@
free(cr->cr_groups, M_CRED);
cr->cr_groups = malloc(nbytes, M_CRED, M_WAITOK | M_ZERO);
- cr->cr_agroups = nbytes / sizeof(gid_t);
+
+ /*
+ * Note that this is technically incorrect, but ngroups_max cannot be
+ * configured at runtime today. We'll need to do crcopysafe()
+ * differently if we for some reason ever add a sysctl that can increase
+ * our limit to avoid unnecessary allocations.
+ */
+ cr->cr_agroups = MIN(ngroups_max, nbytes / sizeof(gid_t));
}
/*

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 22, 6:54 AM (4 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31960460
Default Alt Text
D51660.id159517.diff (617 B)

Event Timeline