* readelf.c (get_32bit_dynamic_section): Correct number of entries

translated from external to internal form.
	(get_64bit_dynamic_section): Likewise.
This commit is contained in:
Alan Modra 2004-06-22 05:17:55 +00:00
parent 929ba6e7ec
commit fb514b26fa
2 changed files with 18 additions and 14 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -4656,9 +4656,8 @@ dynamic_section_ia64_val (Elf_Internal_Dyn *entry)
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"));
@ -4674,12 +4673,12 @@ get_32bit_dynamic_section (FILE *file)
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);
@ -4690,9 +4689,8 @@ get_32bit_dynamic_section (FILE *file)
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"));
@ -4708,12 +4706,12 @@ get_64bit_dynamic_section (FILE *file)
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);