pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: waldump: fix use-after-free in search_directory().
Date: Mon, 28 Mar 2022 01:29:36 +0000
Message-ID: <E1nYeCN-001gX2-S4@gemulon.postgresql.org> (raw)

waldump: fix use-after-free in search_directory().

After closedir() dirent->d_name is not valid anymore. As there alerady are a
few places relying on the limited lifetime of pg_waldump, do so here as well,
and just pg_strdup() the string.

The bug was introduced in fc49e24fa69a.

Found by UBSan, run locally.

Backpatch: 11-, like fc49e24fa69 itself.

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/344d89abf36b9ea559a4b25543bbc7d4206988f5

Modified Files
--------------
src/bin/pg_waldump/pg_waldump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



view thread (5+ messages)

Message-ID: <E1nYeCN-001gX2-S4@gemulon.postgresql.org>
Permalink:  ../E1nYeCN-001gX2-S4@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nYeCN-001gX2-S4@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: waldump: fix use-after-free in search_directory().
  In-Reply-To: <E1nYeCN-001gX2-S4@gemulon.postgresql.org>
  References: <E1nYeCN-001gX2-S4@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox