From 3ebc886f8a1a9ed7bf0a42c0793be7cbe09680e8 Mon Sep 17 00:00:00 2001 From: John Wu Date: Mon, 18 Feb 2019 03:44:38 -0500 Subject: [PATCH] Make sure PPID exists --- native/jni/magiskhide/proc_monitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/native/jni/magiskhide/proc_monitor.cpp b/native/jni/magiskhide/proc_monitor.cpp index 787d6c34f..af7b0b95f 100644 --- a/native/jni/magiskhide/proc_monitor.cpp +++ b/native/jni/magiskhide/proc_monitor.cpp @@ -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)