DF-0040 / fix.diff
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -548,7 +548,7 @@ error = ENOEXEC; goto out; } - if (symstrindex < 0 || symstrindex > hdr->e_shnum || + if (symstrindex < 0 || symstrindex >= hdr->e_shnum || shdr[symstrindex].sh_type != SHT_STRTAB) { link_elf_obj_error(filename, "file has invalid symbol strings"); error = ENOEXEC; @@ -601,6 +601,7 @@ /* Do we have a string table for the section names? */ shstrindex = -1; if (hdr->e_shstrndx != 0 && + hdr->e_shstrndx < hdr->e_shnum && shdr[hdr->e_shstrndx].sh_type == SHT_STRTAB) { shstrindex = hdr->e_shstrndx; ef->shstrcnt = shdr[shstrindex].sh_size; |