mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-01-11 23:33:37 +00:00
realpath /proc/pid/cwd
prevent cross mount namespace
This commit is contained in:
parent
6c5b261804
commit
b2f152e641
@ -314,7 +314,9 @@ void su_daemon_handler(int client, const sock_cred *cred) {
|
|||||||
umask(022);
|
umask(022);
|
||||||
char path[32];
|
char path[32];
|
||||||
snprintf(path, sizeof(path), "/proc/%d/cwd", ctx.pid);
|
snprintf(path, sizeof(path), "/proc/%d/cwd", ctx.pid);
|
||||||
chdir(path);
|
char cwd[PATH_MAX];
|
||||||
|
if (realpath(path, cwd))
|
||||||
|
chdir(cwd);
|
||||||
snprintf(path, sizeof(path), "/proc/%d/environ", ctx.pid);
|
snprintf(path, sizeof(path), "/proc/%d/environ", ctx.pid);
|
||||||
char buf[4096] = { 0 };
|
char buf[4096] = { 0 };
|
||||||
int fd = xopen(path, O_RDONLY);
|
int fd = xopen(path, O_RDONLY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user