aboutsummaryrefslogtreecommitdiff
path: root/subhook_private.h
diff options
context:
space:
mode:
authorZeex <zeex@rocketmail.com>2020-11-02 03:18:01 +0600
committerZeex <zeex@rocketmail.com>2020-11-02 03:19:54 +0600
commit314603bc42120c0c40571eaaa9c8f022992c70a6 (patch)
treec8d60604e78b31671c9267e2a09ab50068136b7f /subhook_private.h
parent9cc118d25ea4775c03a62860aaa604fea56de0c6 (diff)
downloadsubhook-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 'subhook_private.h')
-rw-r--r--subhook_private.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/subhook_private.h b/subhook_private.h
index 9d54781..16ad8fd 100644
--- a/subhook_private.h
+++ b/subhook_private.h
@@ -48,6 +48,8 @@ struct subhook_struct {
size_t trampoline_len;
};
-void *subhook_unprotect(void *address, size_t size);
+int subhook_unprotect(void *address, size_t size);
+void *subhook_alloc_code(size_t size);
+int subhok_free_code(void *address, size_t size);
#endif /* SUBHOOK_PRIVATE_H */