Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F165016421
D51508.id159046.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
553 B
Referenced Files
None
Subscribers
None
D51508.id159046.diff
View Options
diff --git a/usr.sbin/chroot/chroot.c b/usr.sbin/chroot/chroot.c
--- a/usr.sbin/chroot/chroot.c
+++ b/usr.sbin/chroot/chroot.c
@@ -111,7 +111,12 @@
ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1;
if ((gidlist = malloc(sizeof(gid_t) * ngroups_max)) == NULL)
err(1, "malloc");
- for (gids = 0;
+ /* Populate the egid slot in our groups to avoid accidents. */
+ if (gid == 0)
+ gidlist[0] = getegid();
+ else
+ gidlist[0] = gid;
+ for (gids = 1;
(p = strsep(&grouplist, ",")) != NULL && gids < ngroups_max; ) {
if (*p == '\0')
continue;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Aug 6, 8:29 AM (12 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36005976
Default Alt Text
D51508.id159046.diff (553 B)
Attached To
Mode
D51508: chroot: don't clobber the egid with the first supplemental group
Attached
Detach File
Event Timeline
Log In to Comment