Skip to content

Commit 8ebd481

Browse files
maskitjeffbencteux
authored andcommitted
Fix unchecked return value of initgroups() (#11855)
* Fix unchecked return value of initgroups() Signed-off-by: Jeffrey Bencteux <[email protected]> * clang-format --------- Signed-off-by: Jeffrey Bencteux <[email protected]> Co-authored-by: Jeffrey Bencteux <[email protected]> (cherry picked from commit ae63809)
1 parent b6ff8db commit 8ebd481

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tscore/ink_cap.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ impersonate(const struct passwd *pwd, ImpersonationLevel level)
156156
#endif
157157

158158
// Always repopulate the supplementary group list for the new user.
159-
initgroups(pwd->pw_name, pwd->pw_gid);
159+
if (initgroups(pwd->pw_name, pwd->pw_gid) != 0) {
160+
Fatal("switching to user %s, failed to initialize supplementary groups ID %ld", pwd->pw_name, (long)pwd->pw_gid);
161+
}
160162

161163
switch (level) {
162164
case IMPERSONATE_PERMANENT:

0 commit comments

Comments
 (0)