Skip to content

Commit

Permalink
fix Android 4.x因未删除换行符导致无法解析/proc/self/maps的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
chengjian.scj committed Dec 21, 2023
1 parent 9254017 commit 0d9da98
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions bytehook/src/main/cpp/bh_dl_iterate.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ static int bh_dl_iterate_by_maps(int (*callback)(struct dl_phdr_info *, size_t,
bool try_next_line = false;

while (fgets(line, sizeof(buf1), maps)) {
bh_util_trim_ending(line);
// Parsing maps directly has too much uncertainty, so it needs to be strict.
if (!bh_util_ends_with(line, BH_CONST_BASENAME_APP_PROCESS) && !bh_util_ends_with(line, ".so")) continue;

Expand Down

0 comments on commit 0d9da98

Please sign in to comment.