mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-01-04 16:17:39 +00:00
Setuid after read proc
This commit is contained in:
parent
d6abaf846e
commit
2cf33d635d
@ -335,7 +335,6 @@ void su_daemon_handler(int client, struct ucred *credential) {
|
|||||||
|
|
||||||
// Setup environment
|
// Setup environment
|
||||||
umask(022);
|
umask(022);
|
||||||
set_identity(ctx.req.uid);
|
|
||||||
char path[32], buf[4096];
|
char path[32], buf[4096];
|
||||||
snprintf(path, sizeof(path), "/proc/%d/cwd", ctx.pid);
|
snprintf(path, sizeof(path), "/proc/%d/cwd", ctx.pid);
|
||||||
xreadlink(path, buf, sizeof(buf));
|
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);
|
execvp(ctx.req.shell, (char **) argv);
|
||||||
fprintf(stderr, "Cannot execute %s: %s\n", ctx.req.shell, strerror(errno));
|
fprintf(stderr, "Cannot execute %s: %s\n", ctx.req.shell, strerror(errno));
|
||||||
PLOGE("exec");
|
PLOGE("exec");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user