Skip to content

Commit

Permalink
fix: only iterate the main executable program headers
Browse files Browse the repository at this point in the history
The resource gets injected in the main executable, so there is no need
to iterate the other shared libraries that are loaded by the program.
This also resolves a security concern.

Refs: #77 (review)
Signed-off-by: Darshan Sen <[email protected]>
  • Loading branch information
RaisinTen committed Mar 2, 2023
1 parent 19ab453 commit 35a279f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions postject-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ static int postject__dl_iterate_phdr_callback(struct dl_phdr_info* info,
}
}

// skip to the next shared object
return 0;
// wasn't able to find the note in the main executable program headers, so
// terminate the search
return 1;
}
#endif

Expand Down

0 comments on commit 35a279f

Please sign in to comment.