This is the mail archive of the glibc-bugs@sourceware.org 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]
Other format: [Raw text]

[Bug dynamic-link/22238] NULL pointer dereference in dlopen on out-of-memory


https://sourceware.org/bugzilla/show_bug.cgi?id=22238

--- Comment #13 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Carlos O'Donell from comment #11)

> I had to fix one more thing though:
> 
> diff --git a/elf/dl-error-skeleton.c b/elf/dl-error-skeleton.c
> index 5b0fc89..6543e39 100644
> --- a/elf/dl-error-skeleton.c
> +++ b/elf/dl-error-skeleton.c
> @@ -75,6 +75,8 @@ fatal_error (int errcode, const char *objname, const char
> *occasion,
>              const char *errstring)
>  {
>    char buffer[1024];
> +  if (objname == NULL)
> +    objname = "NULL";
>    _dl_fatal_printf ("%s: %s: %s%s%s%s%s\n",
>                     RTLD_PROGNAME,
>                     occasion ?: N_("error while loading shared libraries"),
> ---
> 
> Otherwise we crash in fatal_error attempting to deref objname.
> 
> Florian, what do you think we should do here? It's common practice to elide
> objname in some of these calls and use NULL.
> 
> In the old code after refactoring we had:
> 9e78f6f6 (Florian Weimer 2016-11-30 15:59:57 +0100  89)   if (objname ==
> NULL)
> 9e78f6f6 (Florian Weimer 2016-11-30 15:59:57 +0100  90)     objname = "";
> 
> Which we dropped in a later cleanup.
> 
> We should probably put back the these two lines in fatal_error.

Right, but this is a separate fix (and please use "", not "NULL").

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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