diff options
author | marcel <marcel@FreeBSD.org> | 2011-10-16 14:11:05 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2011-10-16 14:11:05 +0000 |
commit | 4718565769d4ef7d3aecebae9fe844f4203e09e1 (patch) | |
tree | 8016c68f83aa6845726fae3dd9641d61f446a3a6 /usr.bin | |
parent | 2cc524e37179293341c5292b96661aa161e33cd7 (diff) | |
download | FreeBSD-src-4718565769d4ef7d3aecebae9fe844f4203e09e1.zip FreeBSD-src-4718565769d4ef7d3aecebae9fe844f4203e09e1.tar.gz |
o Use C99 designated initializer to properly handle ELFOSABI_STANDALONE.
o In elf_get_byte(), cast through uint8_t and not char to avoid sign
extension.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/elfdump/elfdump.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/elfdump/elfdump.c b/usr.bin/elfdump/elfdump.c index 8bd71e8..9acb503 100644 --- a/usr.bin/elfdump/elfdump.c +++ b/usr.bin/elfdump/elfdump.c @@ -282,11 +282,12 @@ const char *ei_data[] = { "ELFDATANONE", "ELFDATA2LSB", "ELFDATA2MSB" }; -const char *ei_abis[] = { +const char *ei_abis[256] = { "ELFOSABI_SYSV", "ELFOSABI_HPUX", "ELFOSABI_NETBSD", "ELFOSABI_LINUX", - "ELFOSABI_HURD", "ELFOSABI_86OPEN", "ELFOSABI_SOLARIS", - "ELFOSABI_MONTEREY", "ELFOSABI_IRIX", "ELFOSABI_FREEBSD", - "ELFOSABI_TRU64", "ELFOSABI_MODESTO", "ELFOSABI_OPENBSD" + "ELFOSABI_HURD", "ELFOSABI_86OPEN", "ELFOSABI_SOLARIS", "ELFOSABI_AIX", + "ELFOSABI_IRIX", "ELFOSABI_FREEBSD", "ELFOSABI_TRU64", + "ELFOSABI_MODESTO", "ELFOSABI_OPENBSD", + [255] = "ELFOSABI_STANDALONE" }; const char *p_types[] = { @@ -931,10 +932,10 @@ elf_get_byte(Elf32_Ehdr *e, void *base, elf_member_t member) val = 0; switch (e->e_ident[EI_CLASS]) { case ELFCLASS32: - val = ((char *)base)[elf32_offsets[member]]; + val = ((uint8_t *)base)[elf32_offsets[member]]; break; case ELFCLASS64: - val = ((char *)base)[elf64_offsets[member]]; + val = ((uint8_t *)base)[elf64_offsets[member]]; break; case ELFCLASSNONE: errx(1, "invalid class"); |