Restrict pointer aliasing

Close #6354, close #6353
This commit is contained in:
topjohnwu
2022-10-31 16:35:33 -07:00
parent 1e53a5555e
commit 44643ad7b3
5 changed files with 16 additions and 14 deletions

View File

@@ -161,8 +161,10 @@ static vector<int> get_module_fds(bool is_64_bit) {
}
static bool get_exe(int pid, char *buf, size_t sz) {
ssprintf(buf, sz, "/proc/%d/exe", pid);
return xreadlink(buf, buf, sz) > 0;
char exe[128];
if (ssprintf(exe, sizeof(exe), "/proc/%d/exe", pid) < 0)
return false;
return xreadlink(exe, buf, sz) > 0;
}
static pthread_mutex_t zygiskd_lock = PTHREAD_MUTEX_INITIALIZER;