diff options
author | Zeex <zeex@rocketmail.com> | 2020-11-02 03:18:01 +0600 |
---|---|---|
committer | Zeex <zeex@rocketmail.com> | 2020-11-02 03:19:54 +0600 |
commit | 314603bc42120c0c40571eaaa9c8f022992c70a6 (patch) | |
tree | c8d60604e78b31671c9267e2a09ab50068136b7f /tests | |
parent | 9cc118d25ea4775c03a62860aaa604fea56de0c6 (diff) | |
download | subhook-314603bc42120c0c40571eaaa9c8f022992c70a6.zip subhook-314603bc42120c0c40571eaaa9c8f022992c70a6.tar.gz subhook-314603bc42120c0c40571eaaa9c8f022992c70a6.tar.bz2 |
Fix address overflow in trampoline
Allocate memory for storing the trampoline code via mmap() with MAP_32BIT flag
to make sure that it stays withing 2GB range.
Also, add missing calls to subhook_free() in the C test program (C++ calls it
implicitly already via destructor).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/test.c b/tests/test.c index bbf75b5..d8b39fd 100644 --- a/tests/test.c +++ b/tests/test.c @@ -58,6 +58,8 @@ int main() { } foo(); + subhook_free(foo_hook); + puts("Testing trampoline"); subhook_t foo_hook_tr = subhook_new((void *)foo, @@ -74,5 +76,7 @@ int main() { } foo(); + subhook_free(foo_hook_tr); + return EXIT_SUCCESS; } |