Skip to content

Commit

Permalink
fix(hooks): require page to be at-least readable
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed May 9, 2024
1 parent f6eee3b commit aeec3f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/lime/hooks/hook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace lime
protect,
relocate,
bad_page,
bad_prot,
};

class hook_base
Expand Down
5 changes: 5 additions & 0 deletions src/hooks.hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ namespace lime
return tl::make_unexpected(hook_error::bad_page);
}

if (!(page->prot() & lime::protection::read))
{
return tl::make_unexpected(hook_error::bad_prot);
}

auto start = instruction::unsafe(source);

if (auto follow = start.follow(); follow)
Expand Down

0 comments on commit aeec3f6

Please sign in to comment.