Skip to content

Commit

Permalink
fix(hook): near jump should only be used with trampoline
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed May 13, 2024
1 parent b1278f3 commit 7aefd93
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hooks.hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ namespace lime
return tl::make_unexpected(hook_error::relocate);
}

const auto spring_board = near ? false : rtn->m_impl->create_springboard();
const auto spring_board = rtn->m_impl->create_springboard();
const auto destination = spring_board ? rtn->m_impl->spring_board->start() : target;

const auto jump = impl::make_jmp(start->addr(), destination, near || spring_board);
const auto jump = impl::make_jmp(start->addr(), destination, spring_board);

if (!rtn->m_impl->source_page->protect(rwx))
{
Expand Down Expand Up @@ -403,7 +403,7 @@ namespace lime

if (near || arch == architecture::x86)
{
rtn.insert(rtn.end(), {0xE9});
rtn = {0xE9};
rtn.resize(rtn.size() + sizeof(std::int32_t));

auto relative = static_cast<std::int32_t>(target - source - size::jmp_near);
Expand Down

0 comments on commit 7aefd93

Please sign in to comment.