diff options
author | van Hauser <vh@thc.org> | 2024-10-07 10:00:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-07 10:00:04 +0200 |
commit | 31ed850c4bc9ed742b43ae8ae81c537f1a4e7433 (patch) | |
tree | 14339b598af5e81abe666ac216741a2ca29e7e1c | |
parent | 146e535f7b644a3d38f8e90c415974b23ff295c0 (diff) | |
parent | 994ac558787cc10512854b85115e7f5e5e268513 (diff) | |
download | afl++-31ed850c4bc9ed742b43ae8ae81c537f1a4e7433.tar.gz |
Merge pull request #2218 from ea/stable
Fix uninitialized alloc_canary in libdislocator
-rw-r--r-- | utils/libdislocator/libdislocator.so.c | 9 |
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 *, ...) { |