Skip to content

Commit

Permalink
[ELFLOADER] Zero'd memory when using mmap and filesize smaller than m…
Browse files Browse the repository at this point in the history
…emsize
  • Loading branch information
ptitSeb committed Jan 21, 2024
1 parent 159351f commit 2c58b45
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/elfs/elfloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 2c58b45

Please sign in to comment.