mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 05:27:38 +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);
|
||||
char path[32];
|
||||
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);
|
||||
char buf[4096] = { 0 };
|
||||
int fd = xopen(path, O_RDONLY);
|
||||
|
Loading…
x
Reference in New Issue
Block a user