Skip to content

Commit

Permalink
Fix[hook]: improve dylib patching check
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduytran0 committed Jun 21, 2024
1 parent ec04885 commit 2752cf5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Natives/main_hook.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ void hooked_exit(int code) {
}

void* hooked_dlopen(const char* path, int mode) {
const char *home = getenv("POJAV_HOME");
const char *home = getenv("HOME");
// Only proceed to check if dylib is in the home dir
// Path input from jvm is absolute path(?)
if (!path || strncmp(path, home, strlen(home))) {
char fullpath[PATH_MAX];
if (!path || !realpath(path, fullpath) || !strstr(fullpath, home)) {
return orig_dlopen(path, mode);
}

Expand Down

0 comments on commit 2752cf5

Please sign in to comment.