Commit: readelf: Prevent seg-fault handling corrupt archives
Nick Clifton
nickc@redhat.com
Thu Feb 7 16:06:00 GMT 2013
Hi Guys,
I am checking in the patch below to prevent a seg-fault in readelf
when it is attempting to display the contents of a corrupt archive.
Cheers
Nick
binutils/ChangeLog
2013-02-07 Nick Clifton <nickc@redhat.com>
* elfcomm.c (get_archive_member_name): Prevent seg-fault if a
corrupt archive uses long names but has no long name table.
Index: binutils/elfcomm.c
===================================================================
RCS file: /cvs/src/src/binutils/elfcomm.c,v
retrieving revision 1.3
diff -u -3 -p -r1.3 elfcomm.c
--- binutils/elfcomm.c 17 Jul 2012 16:29:36 -0000 1.3
+++ binutils/elfcomm.c 7 Feb 2013 16:05:14 -0000
@@ -586,6 +586,12 @@ get_archive_member_name (struct archive_
char *member_file_name;
char *member_name;
+ if (arch->longnames == NULL || arch->longnames_size == 0)
+ {
+ error (_("Archive member uses long names, but no longname table found\n"));
+ return NULL;
+ }
+
arch->nested_member_origin = 0;
k = j = strtoul (arch->arhdr.ar_name + 1, &endp, 10);
if (arch->is_thin_archive && endp != NULL && * endp == ':')
More information about the Binutils
mailing list