Skip to content

Commit

Permalink
refactor(hook): add padding
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed May 13, 2024
1 parent cf2ba3c commit 0cf1c1a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/hooks.hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,15 @@ namespace lime
}

const auto destination = spring_board ? rtn->m_impl->spring_board->start() : target;
const auto jump = impl::make_jmp(start->addr(), destination, spring_board);

auto jump = impl::make_jmp(start->addr(), destination, spring_board);
const auto remaining = rtn->m_impl->prologue.size() - jump.size();

if (remaining > 0)
{
std::vector<std::uint8_t> padding(remaining, 0x90);
std::ranges::move(padding, std::back_inserter(jump));
}

if (!rtn->m_impl->source_page->protect(rwx))
{
Expand Down

0 comments on commit 0cf1c1a

Please sign in to comment.