diff options
author | Tristan Gingold <tristan.gingold@adacore.com> | 2014-04-04 12:38:24 +0200 |
---|---|---|
committer | Tristan Gingold <tristan.gingold@adacore.com> | 2014-04-04 14:32:01 +0200 |
commit | ca148c5ad5baae432b763cc40d01333303ceb9db (patch) | |
tree | aeac01639b12d8dd27091027316e1ab8e822fcc1 | |
parent | 47c509326557dcef05608226b8d6428476289886 (diff) | |
download | gdb-ca148c5ad5baae432b763cc40d01333303ceb9db.zip gdb-ca148c5ad5baae432b763cc40d01333303ceb9db.tar.gz gdb-ca148c5ad5baae432b763cc40d01333303ceb9db.tar.bz2 |
mach-o: fix section name conversion from bfd to mach-o.
bfd/
* mach-o.c (bfd_mach_o_convert_section_name_to_mach_o): Fix
thinko on names length.
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/mach-o.c | 9 |
2 files changed, 10 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1eac58a..d07053a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,10 @@ 2014-04-04 Tristan Gingold <gingold@adacore.com> + * mach-o.c (bfd_mach_o_convert_section_name_to_mach_o): Fix + thinko on names length. + +2014-04-04 Tristan Gingold <gingold@adacore.com> + * mach-o-i386.c (bfd_mach_o_i386_swap_reloc_out): Use target index of output_section. * mach-o-x86-64.c (bfd_mach_o_x86_64_swap_reloc_out): Ditto. diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 43b24c9..5203c0f 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -467,7 +467,8 @@ bfd_mach_o_convert_section_name_to_mach_o (bfd *abfd ATTRIBUTE_UNUSED, seglen = dot - name; seclen = len - (dot + 1 - name); - if (seglen < 16 && seclen < 16) + if (seglen <= BFD_MACH_O_SEGNAME_SIZE + && seclen <= BFD_MACH_O_SECTNAME_SIZE) { memcpy (section->segname, name, seglen); section->segname[seglen] = 0; @@ -1325,9 +1326,9 @@ bfd_mach_o_write_relocs (bfd *abfd, bfd_mach_o_section *section) v = BFD_MACH_O_SR_SCATTERED | (pinfo->r_pcrel ? BFD_MACH_O_SR_PCREL : 0) - | BFD_MACH_O_SET_SR_LENGTH(pinfo->r_length) - | BFD_MACH_O_SET_SR_TYPE(pinfo->r_type) - | BFD_MACH_O_SET_SR_ADDRESS(pinfo->r_address); + | BFD_MACH_O_SET_SR_LENGTH (pinfo->r_length) + | BFD_MACH_O_SET_SR_TYPE (pinfo->r_type) + | BFD_MACH_O_SET_SR_ADDRESS (pinfo->r_address); /* Note: scattered relocs have field in reverse order... */ bfd_put_32 (abfd, v, raw.r_address); bfd_put_32 (abfd, pinfo->r_value, raw.r_symbolnum); |