mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Don't assume objects in program sections have a size of a pointer.
The size of the object at 'addr' is unknown and might be smaller than the size of a pointer (e.g. some x86 instructions are smaller than a pointer). Instead, just check that the address is in the bounds of the program header. Reported by: CHERI (indirectly) Reviewed by: kib, brooks Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26279
This commit is contained in:
parent
1a4531bc98
commit
97bdc65f27
1 changed files with 1 additions and 1 deletions
|
|
@ -65,7 +65,7 @@ __elf_phdr_match_addr(struct dl_phdr_info *phdr_info, void *addr)
|
|||
#endif
|
||||
|
||||
if (phdr_info->dlpi_addr + ph->p_vaddr <= (uintptr_t)addr &&
|
||||
(uintptr_t)addr + sizeof(addr) < phdr_info->dlpi_addr +
|
||||
(uintptr_t)addr < phdr_info->dlpi_addr +
|
||||
ph->p_vaddr + ph->p_memsz)
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue