+2004-06-22 Alan Modra <amodra@bigpond.net.au>
+
+ * readelf.c (get_32bit_dynamic_section): Correct number of entries
+ translated from external to internal form.
+ (get_64bit_dynamic_section): Likewise.
+
2004-06-18 Jie Zhang <zhangjie@magima.com.cn>
* readelf.c (process_program_headers): When locating the dynamic
static int
get_32bit_dynamic_section (FILE *file)
{
- Elf32_External_Dyn *edyn;
+ Elf32_External_Dyn *edyn, *ext;
Elf_Internal_Dyn *entry;
- bfd_size_type i;
edyn = get_data (NULL, file, dynamic_addr, dynamic_size,
_("dynamic section"));
return 0;
}
- for (i = 0, entry = dynamic_section;
- i < dynamic_size;
- i++, entry++)
+ for (ext = edyn, entry = dynamic_section;
+ (char *) ext < (char *) edyn + dynamic_size;
+ ext++, entry++)
{
- entry->d_tag = BYTE_GET (edyn[i].d_tag);
- entry->d_un.d_val = BYTE_GET (edyn[i].d_un.d_val);
+ entry->d_tag = BYTE_GET (ext->d_tag);
+ entry->d_un.d_val = BYTE_GET (ext->d_un.d_val);
}
free (edyn);
static int
get_64bit_dynamic_section (FILE *file)
{
- Elf64_External_Dyn *edyn;
+ Elf64_External_Dyn *edyn, *ext;
Elf_Internal_Dyn *entry;
- bfd_size_type i;
edyn = get_data (NULL, file, dynamic_addr, dynamic_size,
_("dynamic section"));
return 0;
}
- for (i = 0, entry = dynamic_section;
- i < dynamic_size;
- i++, entry++)
+ for (ext = edyn, entry = dynamic_section;
+ (char *) ext < (char *) edyn + dynamic_size;
+ ext++, entry++)
{
- entry->d_tag = BYTE_GET8 (edyn[i].d_tag);
- entry->d_un.d_val = BYTE_GET8 (edyn[i].d_un.d_val);
+ entry->d_tag = BYTE_GET8 (ext->d_tag);
+ entry->d_un.d_val = BYTE_GET8 (ext->d_un.d_val);
}
free (edyn);