From: Mark Wielaard Date: Mon, 15 Dec 2014 10:17:33 +0000 (+0100) Subject: libelf: Clear any garbage left in the ar name table. X-Git-Tag: elfutils-0.161~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9520242b2ab23a3e713f2b7d1a968777feb06bfa;p=thirdparty%2Felfutils.git libelf: Clear any garbage left in the ar name table. Signed-off-by: Mark Wielaard --- diff --git a/libelf/ChangeLog b/libelf/ChangeLog index cf168e7f9..7406509e1 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,8 @@ +2014-12-15 Mark Wielaard + + * elf_begin.c (read_long_names): Clear any garbage left in the + name table. + 2014-12-11 Mark Wielaard * elf_begin.c (file_read_elf): Correct ELF64 section offset check. diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c index 7fb5fa5be..c24a36426 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';