Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F131564815
D46913.id144211.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D46913.id144211.diff
View Options
diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c
--- a/sys/kern/subr_param.c
+++ b/sys/kern/subr_param.c
@@ -228,14 +228,19 @@
TUNABLE_ULONG_FETCH("kern.sgrowsiz", &sgrowsiz);
/*
- * Let the administrator set {NGROUPS_MAX}, but disallow values
- * less than NGROUPS_MAX which would violate POSIX.1-2008 or
- * greater than INT_MAX-1 which would result in overflow.
+ * Let the administrator set {NGROUPS_MAX}. Values less than
+ * NGROUPS_MAX would violate POSIX/SuS (see the specification for
+ * <limits.h>, paragraph "Runtime Increasable Values"), whereas INT_MAX
+ * would result in an overflow for the common 'ngroups_max + 1'
+ * computation (to obtain the size of the internal groups array, its
+ * first element being reserved for the effective GID).
*/
ngroups_max = NGROUPS_MAX;
TUNABLE_INT_FETCH("kern.ngroups", &ngroups_max);
if (ngroups_max < NGROUPS_MAX)
ngroups_max = NGROUPS_MAX;
+ else if (ngroups_max >= INT_MAX)
+ ngroups_max = INT_MAX - 1;
/*
* Only allow to lower the maximal pid.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 10, 7:45 AM (18 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23523990
Default Alt Text
D46913.id144211.diff (1 KB)
Attached To
Mode
D46913: cred: 'kern.ngroups' tunable: Limit it to avoid internal overflows
Attached
Detach File
Event Timeline
Log In to Comment