From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>, Roland McGrath <roland@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Don't look at freed memory in dl-deps.c
Date: Wed, 18 Jan 2006 10:04:00 -0000 [thread overview]
Message-ID: <20060118100440.GI4625@sunsite.mff.cuni.cz> (raw)
Hi!
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=178159
verified with valgrind on elf/neededtest4.
_dl_catch_error might allocate objname in the same memory block as errstring
(right after its terminating '\0'), so after free ((char *) errstring)
shouldn't be used. But it is passed down to _dl_signal_error.
if (errno_reason)
_dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
NULL, errstring);
Fixed by making a local copy, verified with valgrind.
2006-01-18 Jakub Jelinek <jakub@redhat.com>
* elf/dl-deps.c (_dl_map_object_deps): In case of failure also make a
copy of objname string.
--- libc/elf/dl-deps.c.jj 2005-06-22 18:34:11.000000000 +0200
+++ libc/elf/dl-deps.c 2006-01-18 10:28:34.000000000 +0100
@@ -247,6 +247,7 @@ _dl_map_object_deps (struct link_map *ma
if (__builtin_expect (errstring != NULL, 0))
{
char *new_errstring = strdupa (errstring);
+ objname = strdupa (objname);
if (malloced)
free ((char *) errstring);
errstring = new_errstring;
@@ -337,6 +338,7 @@ _dl_map_object_deps (struct link_map *ma
if (__builtin_expect (errstring != NULL, 0))
{
char *new_errstring = strdupa (errstring);
+ objname = strdupa (objname);
if (malloced)
free ((char *) errstring);
errstring = new_errstring;
Jakub
next reply other threads:[~2006-01-18 10:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-18 10:04 Jakub Jelinek [this message]
2006-01-18 19:48 ` Roland McGrath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060118100440.GI4625@sunsite.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=drepper@redhat.com \
--cc=libc-hacker@sources.redhat.com \
--cc=roland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).