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:
parent
c81610f7a3
commit
779bbe19dd
1 changed files with 2 additions and 0 deletions
|
@ -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_type == PT_LOAD )
|
||||||
{
|
{
|
||||||
|
if ( pheader->p_memsz < pheader->p_filesz )
|
||||||
|
return errno = EINVAL, 0;
|
||||||
if ( pheader->p_filesz &&
|
if ( pheader->p_filesz &&
|
||||||
pheader->p_vaddr % pheader->p_align !=
|
pheader->p_vaddr % pheader->p_align !=
|
||||||
pheader->p_offset % pheader->p_align )
|
pheader->p_offset % pheader->p_align )
|
||||||
|
|
Loading…
Reference in a new issue