This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]