summaryrefslogtreecommitdiff
path: root/libelf/elf_getarsym.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2013-01-07 14:30:54 -0800
committerRoland McGrath <roland@hack.frob.com>2013-01-07 14:30:54 -0800
commit6722a667bbeb003258b35e0ee773fef9abcbdef0 (patch)
tree2bf223284ce9b38cabf5d76bec4e2f57f89e88a0 /libelf/elf_getarsym.c
parent99d9db00b886b29b961b63d94424321be3ddfca5 (diff)
downloadelfutils-6722a667bbeb003258b35e0ee773fef9abcbdef0.tar.gz
elf_getarsym: Handle unaligned data in archive index.
Diffstat (limited to 'libelf/elf_getarsym.c')
-rw-r--r--libelf/elf_getarsym.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
index ffdd8ada..d0bb28a9 100644
--- a/libelf/elf_getarsym.c
+++ b/libelf/elf_getarsym.c
@@ -240,6 +240,9 @@ elf_getarsym (elf, ptr)
else
{
file_data = (void *) (elf->map_address + off);
+ if (!ALLOW_UNALIGNED
+ && ((uintptr_t) file_data & -(uintptr_t) n) != 0)
+ file_data = memcpy (alloca (sz), elf->map_address + off, sz);
str_data = (char *) (elf->map_address + off + sz);
}