This is the mail archive of the binutils@sources.redhat.com 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]

Re: ld doesn't relocate sysroot if called as tooldir/bin/ld


On Feb 25, 2003, Nick Clifton <nickc at redhat dot com> wrote:

> Approved and applied - thanks!

Thanks.  I'm going ahead and checking this one in as obvious.  Fixes a
heap corruption problem.

Index: ld/ChangeLog
from  Alexandre Oliva  <aoliva at redhat dot com>
	* emultempl/elf32.em (gld${EMULATION_NAME}_add_sysroot): Fix
	memory allocation error.

Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.91
diff -u -p -r1.91 elf32.em
--- ld/emultempl/elf32.em 21 Feb 2003 10:51:24 -0000 1.91
+++ ld/emultempl/elf32.em 26 Feb 2003 00:42:26 -0000
@@ -461,7 +461,7 @@ gld${EMULATION_NAME}_add_sysroot (path)
   if (path[i])
     colons++;
 
-  len = len + colons * strlen (ld_sysroot);
+  len = len + (colons + 1) * strlen (ld_sysroot);
   ret = xmalloc (len + 1);
   strcpy (ret, ld_sysroot);
   p = ret + strlen (ret);
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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