Hi Keith,
All my previous email sent to you are bounced. I am sending this to the
kernel mailing list, hoping you will read it..
H.J.
--- --- modutils-2.4.6/obj/obj_load.c.symbol Mon Aug 20 10:13:50 2001 +++ modutils-2.4.6/obj/obj_load.c Mon Aug 20 10:23:00 2001 @@ -257,7 +257,7 @@ obj_load (int fp, Elf32_Half e_type, con { case SHT_RELM: { - unsigned long nrel, j; + unsigned long nrel, j, nsyms; ElfW(RelM) *rel; struct obj_section *symtab; char *strtab; @@ -273,6 +273,7 @@ obj_load (int fp, Elf32_Half e_type, con nrel = sec->header.sh_size / sizeof(ElfW(RelM)); rel = (ElfW(RelM) *) sec->contents; symtab = f->sections[sec->header.sh_link]; + nsyms = symtab->header.sh_size / symtab->header.sh_entsize; strtab = f->sections[symtab->header.sh_link]->contents; /* Save the relocate type in each symbol entry. */ @@ -284,6 +285,13 @@ obj_load (int fp, Elf32_Half e_type, con symndx = ELFW(R_SYM)(rel->r_info); if (symndx) { + if (symndx >= nsyms) + { + error("%s: Bad symbol index: %08lx >= %08lx", + filename, symndx, nsyms); + continue; + } + extsym = ((ElfW(Sym) *) symtab->contents) + symndx; if (ELFW(ST_BIND)(extsym->st_info) == STB_LOCAL) { --- modutils-2.4.6/obj/obj_reloc.c.symbol Mon Aug 20 10:20:52 2001 +++ modutils-2.4.6/obj/obj_reloc.c Mon Aug 20 10:24:32 2001 @@ -284,6 +284,7 @@ obj_relocate (struct obj_file *f, ElfW(A ElfW(RelM) *rel, *relend; ElfW(Sym) *symtab; const char *strtab; + unsigned long nsyms; relsec = f->sections[i]; if (relsec->header.sh_type != SHT_RELM) @@ -296,6 +297,7 @@ obj_relocate (struct obj_file *f, ElfW(A rel = (ElfW(RelM) *)relsec->contents; relend = rel + (relsec->header.sh_size / sizeof(ElfW(RelM))); symtab = (ElfW(Sym) *)symsec->contents; + nsyms = symsec->header.sh_size / symsec->header.sh_entsize; strtab = (const char *)strsec->contents; for (; rel < relend; ++rel) @@ -312,6 +314,13 @@ obj_relocate (struct obj_file *f, ElfW(A if (symndx) { /* Note we've already checked for undefined symbols. */ + + if (symndx >= nsyms) + { + error("Bad symbol index: %08lx >= %08lx", + symndx, nsyms); + continue; + } extsym = &symtab[symndx]; if (ELFW(ST_BIND)(extsym->st_info) == STB_LOCAL) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Aug 23 2001 - 21:00:36 EST