* PATCH: Fix modutils to check ELF symbol index
@ 2001-08-20 17:34 H . J . Lu
2001-08-21 4:55 ` Keith Owens
0 siblings, 1 reply; 2+ messages in thread
From: H . J . Lu @ 2001-08-20 17:34 UTC (permalink / raw)
To: kaos; +Cc: linux kernel
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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: Fix modutils to check ELF symbol index
2001-08-20 17:34 PATCH: Fix modutils to check ELF symbol index H . J . Lu
@ 2001-08-21 4:55 ` Keith Owens
0 siblings, 0 replies; 2+ messages in thread
From: Keith Owens @ 2001-08-21 4:55 UTC (permalink / raw)
To: H . J . Lu; +Cc: linux kernel
On Mon, 20 Aug 2001 10:34:18 -0700,
"H . J . Lu" <hjl@lucon.org> wrote:
>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..
My mail logs for August only show 2 attempts from 24.176.137.160, both
in the past 12 hours. The first was blocked with a 451 response
because the reverse DNS lookup failed, blame home.com for not doing
anything about spammers. The second got through because reverse DNS
worked.
Patch will be in modutils 2.4.8, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-08-21 4:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-20 17:34 PATCH: Fix modutils to check ELF symbol index H . J . Lu
2001-08-21 4:55 ` Keith Owens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox