about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2024-06-05 20:19:38 +0200
committerGitHub <noreply@github.com>2024-06-05 20:19:38 +0200
commit112759cd39fd31c227c03d5dca866952e5f07b7e (patch)
treef9c386827d8b42909bcccdae50f378cf47fa1de1 /src
parent12a87cfacbe2015e378ebae9cca0923a220d1605 (diff)
parente8d098335b24dfd96f88b840617fbb539a6077ab (diff)
downloadafl++-112759cd39fd31c227c03d5dca866952e5f07b7e.tar.gz
Merge pull request #2113 from AFLplusplus/fix_mmap_cmplog
Fix cmplog shared memory size when USEMMAP=1
Diffstat (limited to 'src')
-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);