Commit 2cf33d63 authored by vvb2060's avatar vvb2060 Committed by John Wu

Setuid after read proc

parent d6abaf84
......@@ -335,7 +335,6 @@ void su_daemon_handler(int client, struct ucred *credential) {
// Setup environment
umask(022);
set_identity(ctx.req.uid);
char path[32], buf[4096];
snprintf(path, sizeof(path), "/proc/%d/cwd", ctx.pid);
xreadlink(path, buf, sizeof(buf));
......@@ -363,6 +362,7 @@ void su_daemon_handler(int client, struct ucred *credential) {
}
}
set_identity(ctx.req.uid);
execvp(ctx.req.shell, (char **) argv);
fprintf(stderr, "Cannot execute %s: %s\n", ctx.req.shell, strerror(errno));
PLOGE("exec");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment