From 2e49a6d0109e0e3f88aac9202b5331fe251c7b01 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 12 Aug 2010 13:11:11 +0000 Subject: [PATCH] PR binutils/11742 * readelf.c (get_archive_member_name): Do not read beyond the end of the ar_name field. --- binutils/ChangeLog | 6 ++++++ binutils/readelf.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index e86b293ac03..d051895754b 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2010-08-12 Michael Haubenwallner + + PR binutils/11742 + * readelf.c (get_archive_member_name): Do not read beyond the end + of the ar_name field. + 2010-08-03 Tristan Gingold * dwarf.c (display_debug_lines): Mark file argument unused. diff --git a/binutils/readelf.c b/binutils/readelf.c index 614f761e94e..30a7fcc4a11 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -12556,7 +12556,8 @@ get_archive_member_name (struct archive_info * arch, /* We have a normal (short) name. */ j = 0; - while ((arch->arhdr.ar_name[j] != '/') && (j < 16)) + while ((arch->arhdr.ar_name[j] != '/') + && (j < sizeof (arch->arhdr.ar_name) - 1)) j++; arch->arhdr.ar_name[j] = '\0'; return arch->arhdr.ar_name; -- 2.30.2