mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-21 13:05:04 -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 gid = getgid(), uid = getuid();
|
||||||
int setresgid(gid_t, gid_t, gid_t);
|
int setresgid(gid_t, gid_t, gid_t);
|
||||||
int setresuid(uid_t, uid_t, uid_t);
|
int setresuid(uid_t, uid_t, uid_t);
|
||||||
setresgid(gid, gid, gid);
|
if (setresgid(gid, gid, gid) < 0) {
|
||||||
setresuid(uid, uid, uid);
|
perror("setresgid");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (setresuid(uid, uid, uid) < 0) {
|
||||||
|
perror("setresuid");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
setgid(getgid());
|
if (setgid(getgid()) < 0) {
|
||||||
setuid(getuid());
|
perror("setgid");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (setuid(getuid()) < 0) {
|
||||||
|
perror("setuid");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user