Skip to content

Commit

Permalink
Branch displacement was back-to-front
Browse files Browse the repository at this point in the history
  • Loading branch information
mridgers committed Oct 19, 2021
1 parent 11626ac commit 3047b9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clink/process/src/hook.cpp
Expand Up @@ -290,7 +290,7 @@ static funcptr_t hook_jmp_impl(funcptr_t to_hook, funcptr_t hook)
read_cursor += inst.get_length();
}
*(char*)(write_cursor + 0) = (char)0xe9;
*(int*) (write_cursor + 1) = int(ptrdiff_t(write_cursor) - ptrdiff_t(read_cursor + 5));
*(int*) (write_cursor + 1) = int(ptrdiff_t(read_cursor) - ptrdiff_t(write_cursor + 5));

// Write trampoline out
tramp->hook = hook;
Expand Down

0 comments on commit 3047b9b

Please sign in to comment.