diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2014-12-09 17:57:18 +0800 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2014-12-09 19:50:14 +0800 |
commit | 5e8c1cf25beccac1d22d10dc866912394f42771b (patch) | |
tree | ee16b70f804484dc8e434e647e699ab50da2620f /binutils-2.25/bfd/elf-attrs.c | |
parent | 8eebd7953384e6662ca926b003f2cdda8ccd3ee5 (diff) | |
download | toolchain_binutils-5e8c1cf25beccac1d22d10dc866912394f42771b.tar.gz toolchain_binutils-5e8c1cf25beccac1d22d10dc866912394f42771b.tar.bz2 toolchain_binutils-5e8c1cf25beccac1d22d10dc866912394f42771b.zip |
[2.25] sync to a30720e3e633f275250e26f85ccae5dbdddfb6c6
local patches will be re-applied later
commit a30720e3e633f275250e26f85ccae5dbdddfb6c6
Author: Alan Modra <amodra@gmail.com>
Date: Wed Nov 19 10:30:16 2014 +1030
daily update
Change-Id: Ieb2a3f4dd2ecb289ac5305ff08d428b2847494ab
Diffstat (limited to 'binutils-2.25/bfd/elf-attrs.c')
-rw-r--r-- | binutils-2.25/bfd/elf-attrs.c | 18 |
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) |