summaryrefslogtreecommitdiffstats
path: root/libelf/elf_begin.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2014-12-15 11:17:33 +0100
committerMark Wielaard <[email protected]>2014-12-17 16:43:27 +0100
commit9520242b2ab23a3e713f2b7d1a968777feb06bfa (patch)
treef116a8ae9923d0345c440622e8c3d4ff54dd6309 /libelf/elf_begin.c
parent1b5477ddf360af0f6262c6f15a590448b4e1a65a (diff)
libelf: Clear any garbage left in the ar name table.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libelf/elf_begin.c')
-rw-r--r--libelf/elf_begin.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index 7fb5fa5b..c24a3642 100644
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -734,10 +734,14 @@ read_long_names (Elf *elf)
runp = newp;
while (1)
{
+ char *startp = runp;
runp = (char *) memchr (runp, '/', newp + len - runp);
if (runp == NULL)
- /* This was the last entry. */
- break;
+ {
+ /* This was the last entry. Clear any left overs. */
+ memset (startp, '\0', newp + len - startp);
+ break;
+ }
/* NUL-terminate the string. */
*runp = '\0';