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
1 changed files with 2 additions and 0 deletions

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 )