diff --git a/include/lime/hooks/hook.hpp b/include/lime/hooks/hook.hpp index a1fa861..9147f37 100644 --- a/include/lime/hooks/hook.hpp +++ b/include/lime/hooks/hook.hpp @@ -46,6 +46,7 @@ namespace lime protect, relocate, bad_page, + bad_prot, }; class hook_base diff --git a/src/hooks.hook.cpp b/src/hooks.hook.cpp index 5be1633..99e3442 100644 --- a/src/hooks.hook.cpp +++ b/src/hooks.hook.cpp @@ -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)