mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
modpost: fix off by one in is_executable_section()
The > comparison should be >= to prevent an out of bounds array
access.
Fixes: 52dc0595d5
("modpost: handle relocations mismatch in __ex_table.")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
98d7c7544a
commit
3a3f1e573a
1 changed files with 1 additions and 1 deletions
|
@ -1141,7 +1141,7 @@ static Elf_Sym *find_tosym(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym)
|
||||||
|
|
||||||
static bool is_executable_section(struct elf_info *elf, unsigned int secndx)
|
static bool is_executable_section(struct elf_info *elf, unsigned int secndx)
|
||||||
{
|
{
|
||||||
if (secndx > elf->num_sections)
|
if (secndx >= elf->num_sections)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (elf->sechdrs[secndx].sh_flags & SHF_EXECINSTR) != 0;
|
return (elf->sechdrs[secndx].sh_flags & SHF_EXECINSTR) != 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue