aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYifan Lu2016-10-24 20:37:46 -0700
committerYifan Lu2016-10-24 20:37:46 -0700
commit3e6c30fb5accb8d92c959a87649767ff3dba5314 (patch)
treeebc0ed455c3bb7da383c5edff55359a6cd8a322f
parentForgot NULL pointer check (diff)
downloadsubstitute-3e6c30fb5accb8d92c959a87649767ff3dba5314.tar.gz
Set outro pointer to use mirrored address
-rw-r--r--lib/hook-functions.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/hook-functions.c b/lib/hook-functions.c
index 1c96d61..310b839 100644
--- a/lib/hook-functions.c
+++ b/lib/hook-functions.c
@@ -237,7 +237,8 @@ int substitute_hook_functions(const struct substitute_function_hook *hooks,
hi->outro_trampoline++;
#endif
if (hook->old_ptr)
- *(void **) hook->old_ptr = hi->outro_trampoline;
+ *(uintptr_t *) hook->old_ptr = trampoline_addr +
+ (uintptr_t)(hi->outro_trampoline - outro_trampoline_real);
/* Generate the rewritten start of the function for the outro
* trampoline (complaining if any bad instructions are found)