This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [revised patch]
On Wed, Dec 27, 2000 at 09:50:37AM -0500, Ben Collins wrote:
> 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.
Damn, getting back in the swing after several days off is a real pain.
Here's a patch that actually does work, and doesn't set the objname
wrong (yet again).
Ben
--
-----------=======-=-======-=========-----------=====------------=-=------
/ 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,11 @@
len_errstring = strlen (errstring) + 1;
if (objname == errstring + len_errstring)
{
- len_errstring += strlen (objname) + 1;
- local_errstring = alloca (len_errstring);
- memcpy (local_errstring, errstring, len_errstring);
- objname = local_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 total_len = len_errstring + strlen (objname) + 1;
+ local_errstring = alloca (total_len);
+ objname = (memcpy (local_errstring, errstring, total_len)) + len_errstring;
}
else
{