summaryrefslogtreecommitdiffstats
path: root/binutils-2.25/bfd/elf-attrs.c
diff options
context:
space:
mode:
Diffstat (limited to 'binutils-2.25/bfd/elf-attrs.c')
-rw-r--r--binutils-2.25/bfd/elf-attrs.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/binutils-2.25/bfd/elf-attrs.c b/binutils-2.25/bfd/elf-attrs.c
index 1a1c2c2a..cd0cbcaa 100644
--- a/binutils-2.25/bfd/elf-attrs.c
+++ b/binutils-2.25/bfd/elf-attrs.c
@@ -1,6 +1,5 @@
/* ELF attributes support (based on ARM EABI attributes).
- Copyright 2005, 2006, 2007, 2009, 2010, 2012
- Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -297,7 +296,7 @@ bfd_elf_add_obj_attr_int (bfd *abfd, int vendor, int tag, unsigned int i)
obj_attribute *attr;
attr = elf_new_obj_attr (abfd, vendor, tag);
- attr->type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag) | ATTR_TYPE_FLAG_EXIST;
+ attr->type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
attr->i = i;
}
@@ -320,7 +319,7 @@ bfd_elf_add_obj_attr_string (bfd *abfd, int vendor, int tag, const char *s)
obj_attribute *attr;
attr = elf_new_obj_attr (abfd, vendor, tag);
- attr->type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag) | ATTR_TYPE_FLAG_EXIST;
+ attr->type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
attr->s = _bfd_elf_attr_strdup (abfd, s);
}
@@ -332,7 +331,7 @@ bfd_elf_add_obj_attr_int_string (bfd *abfd, int vendor, int tag,
obj_attribute *attr;
attr = elf_new_obj_attr (abfd, vendor, tag);
- attr->type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag) | ATTR_TYPE_FLAG_EXIST;
+ attr->type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
attr->i = i;
attr->s = _bfd_elf_attr_strdup (abfd, s);
}
@@ -450,7 +449,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
len = hdr->sh_size - 1;
while (len > 0)
{
- int namelen;
+ unsigned namelen;
bfd_vma section_len;
int vendor;
@@ -459,8 +458,11 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
if (section_len > len)
section_len = len;
len -= section_len;
- namelen = strlen ((char *) p) + 1;
- section_len -= namelen + 4;
+ section_len -= 4;
+ namelen = strnlen ((char *) p, section_len) + 1;
+ if (namelen == 0 || namelen >= section_len)
+ break;
+ section_len -= namelen;
if (std_sec && strcmp ((char *) p, std_sec) == 0)
vendor = OBJ_ATTR_PROC;
else if (strcmp ((char *) p, "gnu") == 0)