Skip to content

Commit

Permalink
diod: make SYS_setgroups test safer
Browse files Browse the repository at this point in the history
Problem: on failure, the runtime test of SYS_setgroups replaces diod's
supplementary groups with the test ones.

Pass size=0 to getgroups() when testing the group count.
  • Loading branch information
garlick committed Jan 18, 2025
1 parent 1dec542 commit ca6a65e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/diod.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ _test_setgroups (void)
err_exit ("pthread_create");
if ((err = pthread_join (t, NULL)))
err_exit ("pthread_join");
if ((n = getgroups (ngroups_max, sg)) < 0)
if ((n = getgroups (NULL, 0)) < 0)
err_exit ("getgroups");
if (n == 0)
rc = 1;
Expand Down

0 comments on commit ca6a65e

Please sign in to comment.