1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix vulnerability if p_filesz exceeds p_memsz in ELF loader.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-05-31 12:03:07 +02:00
parent c81610f7a3
commit 779bbe19dd

View file

@ -255,6 +255,8 @@ uintptr_t Load(const void* file_ptr, size_t file_size, Auxiliary* aux)
if ( pheader->p_type == PT_LOAD )
{
if ( pheader->p_memsz < pheader->p_filesz )
return errno = EINVAL, 0;
if ( pheader->p_filesz &&
pheader->p_vaddr % pheader->p_align !=
pheader->p_offset % pheader->p_align )