summaryrefslogtreecommitdiffstats
path: root/libelf/elf_begin.c
diff options
context:
space:
mode:
Diffstat (limited to 'libelf/elf_begin.c')
-rw-r--r--libelf/elf_begin.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index b68410be..13f965f7 100644
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -812,7 +812,14 @@ __libelf_next_arhdr (elf)
if (endp != NULL)
endp[-1] = '\0';
else
- elf->state.ar.raw_name[16] = '\0';
+ {
+ /* In the old BSD style of archive, there is no / terminator.
+ Instead, there is space padding at the end of the name. */
+ size_t i = 15;
+ do
+ elf->state.ar.ar_name[i] = '\0';
+ while (i > 0 && elf->state.ar.ar_name[--i] == ' ');
+ }
elf_ar_hdr->ar_name = elf->state.ar.ar_name;
}