Do explicit bounds checking as a function of the actual size of the

reloc_target_bitmask array as opposed to the (known) index of the last value.
This change fixes CID 691.
This commit is contained in:
Kip Macy 2006-12-10 04:18:03 +00:00
parent 504baf688e
commit 4d249371ce

View File

@ -310,7 +310,7 @@ elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
return (0);
if (rtype == R_SPARC_JMP_SLOT || rtype == R_SPARC_COPY ||
rtype > R_SPARC_UA16)
rtype >= (sizeof(reloc_target_bitmask)/sizeof(long)))
return (-1);
if (RELOC_UNALIGNED(rtype))