aboutsummaryrefslogtreecommitdiff
path: root/utils/libdislocator
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2024-10-07 10:12:51 +0200
committerGitHub <noreply@github.com>2024-10-07 10:12:51 +0200
commitc1e40c5fb7de40dc5f598c609c907ea21e5a078a (patch)
tree1e9da5807fa20692820bf9792b4a42f9731aeeff /utils/libdislocator
parentd21fb1a558b25c4f46692fa999c0028dfe0eecc0 (diff)
parentd6a2edb42a680b999256d5b78082975713973db7 (diff)
downloadafl++-c1e40c5fb7de40dc5f598c609c907ea21e5a078a.tar.gz
Merge pull request #2220 from AFLplusplus/dev
push to stable
Diffstat (limited to 'utils/libdislocator')
-rw-r--r--utils/libdislocator/libdislocator.so.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/utils/libdislocator/libdislocator.so.c b/utils/libdislocator/libdislocator.so.c
index b80be1a1..f41491b1 100644
--- a/utils/libdislocator/libdislocator.so.c
+++ b/utils/libdislocator/libdislocator.so.c
@@ -162,7 +162,7 @@ static u8 alloc_verbose, /* Additional debug messages */
static _Atomic size_t total_mem; /* Currently allocated mem */
static __thread u32 call_depth; /* To avoid recursion via fprintf() */
-static u32 alloc_canary;
+static u32 alloc_canary = ALLOC_CANARY;
/* This is the main alloc function. It allocates one page more than necessary,
sets that tailing page to PROT_NONE, and then increments the return address
@@ -578,6 +578,13 @@ __attribute__((constructor)) void __dislocator_init(void) {
}
+__attribute__((destructor)) void __dislocator_fini(void) {
+
+ alloc_canary = ALLOC_CANARY; // restore to default canary value
+
+}
+
+
/* NetBSD fault handler specific api subset */
void (*esetfunc(void (*fn)(int, const char *, ...)))(int, const char *, ...) {