This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed] Fix buffer overrun in xcoff_link_input_bfd
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: binutils at sourceware dot org
- Date: Wed, 01 Apr 2009 19:10:41 +0100
- Subject: [committed] Fix buffer overrun in xcoff_link_input_bfd
Noticed while using valgrind. Tested on powerpc-ibm-aix6.1 and applied.
Richard
bfd/
* xcofflink.c (bfd_link_input_bfd): Fix buffer overrun.
Index: bfd/xcofflink.c
===================================================================
--- bfd/xcofflink.c 2009-04-01 19:08:36.000000000 +0100
+++ bfd/xcofflink.c 2009-04-01 19:08:42.000000000 +0100
@@ -4268,14 +4268,13 @@ #define N_BTSHFT n_btshft
bfd_coff_swap_lineno_in (input_bfd, linp, &lin);
lin.l_addr.l_symndx = *indexp;
bfd_coff_swap_lineno_out (output_bfd, &lin, linp);
- linp += linesz;
/* Copy the other entries, adjusting their addresses. */
linpend = linp + *lineno_counts * linesz;
offset = (o->output_section->vma
+ o->output_offset
- o->vma);
- for (; linp < linpend; linp += linesz)
+ for (linp += linesz; linp < linpend; linp += linesz)
{
bfd_coff_swap_lineno_in (input_bfd, linp, &lin);
lin.l_addr.l_paddr += offset;