Skip to content

Commit

Permalink
Make sure PPID exists
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Feb 18, 2019
1 parent 5b54ef8 commit 3ebc886
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions native/jni/magiskhide/proc_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ static bool process_pid(int pid) {
return true;

struct stat ns, pns;
int ppid = parse_ppid(pid);
int ppid;
int uid = get_uid(pid);
if (hide_uid.count(uid)) {
// Make sure we can read mount namespace
if (read_ns(pid, &ns) || read_ns(ppid, &pns))
if ((ppid = parse_ppid(pid)) < 0 || read_ns(pid, &ns) || read_ns(ppid, &pns))
return true;
// mount namespace is not separated, we only unmount once
if (ns.st_dev == pns.st_dev && ns.st_ino == pns.st_ino)
Expand Down

0 comments on commit 3ebc886

Please sign in to comment.