summaryrefslogtreecommitdiff
path: root/elf/dl-error.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-error.c')
-rw-r--r--elf/dl-error.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 737bba7421..2eaa7e03d1 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -46,8 +46,13 @@ _dl_signal_error (int errcode,
if (catch)
{
- /* We are inside _dl_catch_error. Return to it. */
- catch->errstring = errstring;
+ /* We are inside _dl_catch_error. Return to it. We have to
+ duplicate the error string since it might be allocated on the
+ stack. */
+ size_t len = strlen (errstring) + 1;
+ catch->errstring = malloc (len);
+ if (catch->errstring != NULL)
+ memcpy (catch->errstring, errstring, len);
catch->objname = objname;
longjmp (catch->env, errcode ?: -1);
}