Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
021cf3f0
Commit
021cf3f0
authored
13 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge branches 'cov217_021' and 'cid_450' into maint-0.2.1
parents
959da6b7
d25feade
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changes/cid_450
+5
-0
5 additions, 0 deletions
changes/cid_450
src/common/compat.c
+14
-2
14 additions, 2 deletions
src/common/compat.c
with
19 additions
and
2 deletions
changes/cid_450
0 → 100644
+
5
−
0
View file @
021cf3f0
o Minor bugfixes:
- Don't stack-allocate the list of supplementary GIDs when we're
about to log them. Stack-allocating NGROUPS_MAX gid_t elements
could take up to 256K, which is way too much stack. Found by
Coverity; CID #450. Bugfix on 0.2.1.7-alpha.
This diff is collapsed.
Click to expand it.
src/common/compat.c
+
14
−
2
View file @
021cf3f0
...
...
@@ -1080,7 +1080,8 @@ log_credential_status(void)
/* Read, effective and saved GIDs */
gid_t
rgid
,
egid
,
sgid
;
/* Supplementary groups */
gid_t
sup_gids
[
NGROUPS_MAX
+
1
];
gid_t
*
sup_gids
=
NULL
;
int
sup_gids_size
;
/* Number of supplementary groups */
int
ngids
;
...
...
@@ -1126,9 +1127,19 @@ log_credential_status(void)
#endif
/* log supplementary groups */
if
((
ngids
=
getgroups
(
NGROUPS_MAX
+
1
,
sup_gids
))
<
0
)
{
sup_gids_size
=
64
;
sup_gids
=
tor_malloc
(
sizeof
(
gid_t
)
*
64
);
while
((
ngids
=
getgroups
(
sup_gids_size
,
sup_gids
))
<
0
&&
errno
==
EINVAL
&&
sup_gids_size
<
NGROUPS_MAX
)
{
sup_gids_size
*=
2
;
sup_gids
=
tor_realloc
(
sup_gids
,
sizeof
(
gid_t
)
*
sup_gids_size
);
}
if
(
ngids
<
0
)
{
log_warn
(
LD_GENERAL
,
"Error getting supplementary GIDs: %s"
,
strerror
(
errno
));
tor_free
(
sup_gids
);
return
-
1
;
}
else
{
int
i
,
retval
=
0
;
...
...
@@ -1158,6 +1169,7 @@ log_credential_status(void)
tor_free
(
cp
);
});
smartlist_free
(
elts
);
tor_free
(
sup_gids
);
return
retval
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment