Drop group privileges before dropping user privileges when execing

This ensures that the saved-set-gid is also set, although this shouldn't
matter in practice since we always call execve() soon after, which
overwrites the saved-set-gid with the effective gid anyway.
This commit is contained in:
Kevin Easton
2016-02-24 16:52:33 +11:00
parent 1359f013e8
commit 6dc89247e2
4 changed files with 6 additions and 4 deletions

View File

@@ -1388,8 +1388,8 @@ FILE *open_compression (char *executable, char *filename, int hook)
#if !defined(WINNT) && !defined(__EMX__)
setsid();
#endif
setuid (getuid ());
setgid (getgid ());
setgid(getgid());
setuid(getuid());
dup2 (pipes[1], 1);
close (pipes[0]);
for (i = 2; i < 256; i++)