aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2024-06-05 19:33:02 +0200
committerAndrea Fioraldi <andreafioraldi@gmail.com>2024-06-05 19:33:02 +0200
commite8d098335b24dfd96f88b840617fbb539a6077ab (patch)
treef9c386827d8b42909bcccdae50f378cf47fa1de1
parent12a87cfacbe2015e378ebae9cca0923a220d1605 (diff)
downloadafl++-e8d098335b24dfd96f88b840617fbb539a6077ab.tar.gz
Fix cmplog shared memory size when USEMMAP=1
-rw-r--r--src/afl-sharedmem.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/afl-sharedmem.c b/src/afl-sharedmem.c
index 8f685633..1dea83f9 100644
--- a/src/afl-sharedmem.c
+++ b/src/afl-sharedmem.c
@@ -239,15 +239,15 @@ u8 *afl_shm_init(sharedmem_t *shm, size_t map_size,
if (shm->cmplog_g_shm_fd == -1) { PFATAL("shm_open() failed"); }
/* configure the size of the shared memory segment */
- if (ftruncate(shm->cmplog_g_shm_fd, map_size)) {
+ if (ftruncate(shm->cmplog_g_shm_fd, sizeof(struct cmp_map))) {
PFATAL("setup_shm(): cmplog ftruncate() failed");
}
/* map the shared memory segment to the address space of the process */
- shm->cmp_map = mmap(0, map_size, PROT_READ | PROT_WRITE, MAP_SHARED,
- shm->cmplog_g_shm_fd, 0);
+ shm->cmp_map = mmap(0, sizeof(struct cmp_map), PROT_READ | PROT_WRITE,
+ MAP_SHARED, shm->cmplog_g_shm_fd, 0);
if (shm->cmp_map == MAP_FAILED) {
close(shm->cmplog_g_shm_fd);