Skip to content

Commit 27f5048

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 b886123 commit 27f5048

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
@@ -160,7 +160,9 @@ impersonate(const struct passwd *pwd, ImpersonationLevel level)
160160
#endif
161161

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

165167
switch (level) {
166168
case IMPERSONATE_PERMANENT:

0 commit comments

Comments
 (0)