aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-error.c2
-rw-r--r--elf/dl-open.c16
2 files changed, 16 insertions, 2 deletions
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 1c6de64..83d984f 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -88,7 +88,7 @@ _dl_signal_error (int errcode, const char *objname, const char *errstring)
else
{
/* This is better than nothing. */
- lcatch->objname = objname;
+ lcatch->objname = "";
lcatch->errstring = _dl_out_of_memory;
}
longjmp (lcatch->env, errcode ?: -1);
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 48bb9f8..9035579 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -391,6 +391,7 @@ _dl_open (const char *file, int mode, const void *caller)
{
/* Some error occurred during loading. */
char *local_errstring;
+ size_t len_errstring;
/* Remove the object from memory. It may be in an inconsistent
state if relocation failed, for example. */
@@ -399,7 +400,20 @@ _dl_open (const char *file, int mode, const void *caller)
/* Make a local copy of the error string so that we can release the
memory allocated for it. */
- local_errstring = strdupa (errstring);
+ 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;
+ }
+ else
+ {
+ local_errstring = alloca (len_errstring);
+ memcpy (local_errstring, errstring, len_errstring);
+ }
+
if (errstring != _dl_out_of_memory)
free ((char *) errstring);