mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-11 16:18:06 -05:00
Don't forget to check the return values of setuid and friends.
[originally from svn r9764]
This commit is contained in:
parent
40ce043a97
commit
74bc2635ad
20
unix/uxpty.c
20
unix/uxpty.c
@ -531,11 +531,23 @@ void pty_pre_init(void)
|
||||
int gid = getgid(), uid = getuid();
|
||||
int setresgid(gid_t, gid_t, gid_t);
|
||||
int setresuid(uid_t, uid_t, uid_t);
|
||||
setresgid(gid, gid, gid);
|
||||
setresuid(uid, uid, uid);
|
||||
if (setresgid(gid, gid, gid) < 0) {
|
||||
perror("setresgid");
|
||||
exit(1);
|
||||
}
|
||||
if (setresuid(uid, uid, uid) < 0) {
|
||||
perror("setresuid");
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
setgid(getgid());
|
||||
setuid(getuid());
|
||||
if (setgid(getgid()) < 0) {
|
||||
perror("setgid");
|
||||
exit(1);
|
||||
}
|
||||
if (setuid(getuid()) < 0) {
|
||||
perror("setuid");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user