public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/release/2.34/master] io: Fix use-after-free in ftw [BZ #26779]
Date: Fri, 11 Nov 2022 16:29:15 +0000 (GMT)	[thread overview]
Message-ID: <20221111162915.729BC384BC3A@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=deea6ab1bcb2696be514e579f3263c234ecc1683

commit deea6ab1bcb2696be514e579f3263c234ecc1683
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Jan 25 17:39:02 2022 -0700

    io: Fix use-after-free in ftw [BZ #26779]
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    (cherry picked from commit ee52ab25ba875f458981fce22c54e3c04c7a17d3)

Diff:
---
 io/ftw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/io/ftw.c b/io/ftw.c
index cf08d9f101..91a4e8e6de 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -324,8 +324,9 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp)
 	  buf[actsize++] = '\0';
 
 	  /* Shrink the buffer to what we actually need.  */
-	  data->dirstreams[data->actdir]->content = realloc (buf, actsize);
-	  if (data->dirstreams[data->actdir]->content == NULL)
+	  void *content = realloc (buf, actsize);
+	  data->dirstreams[data->actdir]->content = content;
+	  if (content == NULL)
 	    {
 	      int save_err = errno;
 	      free (buf);

                 reply	other threads:[~2022-11-11 16:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221111162915.729BC384BC3A@sourceware.org \
    --to=fw@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /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).