This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] libelf: Clear any garbage left in the ar name table.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Mon, 15 Dec 2014 11:18:29 +0100
- Subject: [PATCH] libelf: Clear any garbage left in the ar name table.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
libelf/ChangeLog | 5 +++++
libelf/elf_begin.c | 8 ++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index cf168e7..7406509 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-15 Mark Wielaard <mjw@redhat.com>
+
+ * elf_begin.c (read_long_names): Clear any garbage left in the
+ name table.
+
2014-12-11 Mark Wielaard <mjw@redhat.com>
* elf_begin.c (file_read_elf): Correct ELF64 section offset check.
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index 7fb5fa5..c24a364 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';
--
1.8.3.1