diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-10-16 00:33:37 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-10-16 00:33:37 +0000 |
commit | 170ef42fb5f6edb0a1acc6e6373b272ef3977c63 (patch) | |
tree | 84347035b752b77bec1df23351293d0472e290ff /elf/dl-error.c | |
parent | 8bf95899911f993b492e0314f2ed5cce11d8e10e (diff) | |
download | glibc-170ef42fb5f6edb0a1acc6e6373b272ef3977c63.tar.gz glibc-170ef42fb5f6edb0a1acc6e6373b272ef3977c63.tar.xz glibc-170ef42fb5f6edb0a1acc6e6373b272ef3977c63.zip |
Update.
2000-10-15 Ulrich Drepper <drepper@redhat.com> * elf/dl-error.c (_dl_signal_error): Allocate memory for objname as well. Reported by Alexander V. Lukyanov <lav@yars.free.net>.
Diffstat (limited to 'elf/dl-error.c')
-rw-r--r-- | elf/dl-error.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/elf/dl-error.c b/elf/dl-error.c index 959e1de202..1c6de64275 100644 --- a/elf/dl-error.c +++ b/elf/dl-error.c @@ -76,10 +76,21 @@ _dl_signal_error (int errcode, const char *objname, const char *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. The object name is always a string constant. */ - lcatch->objname = objname; - lcatch->errstring = strdup (errstring); - if (lcatch->errstring == NULL) - lcatch->errstring = _dl_out_of_memory; + size_t len_objname = strlen (objname) + 1; + size_t len_errstring = strlen (errstring) + 1; + + lcatch->errstring = (char *) malloc (len_objname + len_errstring); + if (lcatch->errstring != NULL) + /* Make a copy of the object file name and the error string. */ + lcatch->objname = memcpy (__mempcpy ((char *) lcatch->errstring, + errstring, len_errstring), + objname, len_objname); + else + { + /* This is better than nothing. */ + lcatch->objname = objname; + lcatch->errstring = _dl_out_of_memory; + } longjmp (lcatch->env, errcode ?: -1); } else |