[ELFLOADER] Zero'd memory when using mmap and filesize smaller than memsize

This commit is contained in:
ptitSeb 2024-01-21 12:20:30 +01:00
parent 159351fc3c
commit 2c58b45d8e

View File

@ -271,6 +271,8 @@ int AllocLoadElfMemory(box86context_t* context, elfheader_t* head, int mainbin)
printf_log(log_level, " got %p instead\n", p);
}
} else {
if(e->p_memsz>e->p_filesz)
memset((void*)((uintptr_t)p + e->p_filesz), 0, e->p_memsz-e->p_filesz);
setProtection_elf((uintptr_t)p, head->multiblocks[n].asize, prot);
head->multiblocks[n].p = p;