This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


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

Re: [kon@iki.fi: Bug#80485: glibc-2.2/elf/dl-open.c (_dl_open): suspicious objname handling]


On Wed, Dec 27, 2000 at 09:37:18AM -0500, Ben Collins wrote:
> The original Debian bug report is below. I've attached a patch to fix
> this. I think this is probably responsible for another bug report I had
> concerning the symbol/library not being shown in dlerror() when
> dlopen'ing a library/module with RTLD_NOW, and a symbol not being
> resolved.
> 
> 2000-12-27  Ben Collins  <bcollins@debian.org>
> 
> 	* elf/dl-open.c:_dl_open: correctly set the new objname pointer
> 	  when reallocating the error strings. Bug reported by Kalle
> 	  Olavi Niemitalo <kon@iki.fi>

Sorry, here's the patch.

-- 
 -----------=======-=-======-=========-----------=====------------=-=------
/  Ben Collins  --  ...on that fantastic voyage...  --  Debian GNU/Linux   \
`  bcollins@debian.org  --  bcollins@openldap.org  --  bcollins@linux.com  '
 `---=========------=======-------------=-=-----=-===-======-------=--=---'
Index: elf/dl-open.c
===================================================================
RCS file: /cvs/glibc/libc/elf/dl-open.c,v
retrieving revision 1.65
diff -u -u -r1.65 dl-open.c
--- dl-open.c	2000/12/09 00:01:38	1.65
+++ dl-open.c	2000/12/27 14:33:55
@@ -403,10 +403,13 @@
       len_errstring = strlen (errstring) + 1;
       if (objname == errstring + len_errstring)
 	{
+	  /* Copy both of these, and make sure objname is updated to point
+	   * to the correct place in the newly allocated space.  */
+	  int objname_offset = len_errstring + 1;
 	  len_errstring += strlen (objname) + 1;
 	  local_errstring = alloca (len_errstring);
 	  memcpy (local_errstring, errstring, len_errstring);
-	  objname = local_errstring + len_errstring;
+	  objname = local_errstring + objname_offset;
 	}
       else
 	{

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