summaryrefslogtreecommitdiff
path: root/binutils/elfcomm.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-02-07 16:07:03 +0000
committerNick Clifton <nickc@redhat.com>2013-02-07 16:07:03 +0000
commit2913a1b282ca161edb0cd8c6e15985e582556055 (patch)
tree0aedb093429338fa15b5b0bac9c6bed5d01c9898 /binutils/elfcomm.c
parentc9423f319bf6346f8ad17a48b4d6a757b5e84dd8 (diff)
downloadbinutils-redhat-2913a1b282ca161edb0cd8c6e15985e582556055.tar.gz
* elfcomm.c (get_archive_member_name): Prevent seg-fault if a
corrupt archive uses long names but has no long name table.
Diffstat (limited to 'binutils/elfcomm.c')
-rw-r--r--binutils/elfcomm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/binutils/elfcomm.c b/binutils/elfcomm.c
index a50b1ece38..64d4b21398 100644
--- a/binutils/elfcomm.c
+++ b/binutils/elfcomm.c
@@ -586,6 +586,12 @@ get_archive_member_name (struct archive_info *arch,
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 == ':')