]> git.ipfire.org Git - thirdparty/postgresql.git/commit
waldump: fix use-after-free in search_directory().
authorAndres Freund <andres@anarazel.de>
Wed, 23 Mar 2022 23:38:43 +0000 (16:38 -0700)
committerAndres Freund <andres@anarazel.de>
Mon, 28 Mar 2022 01:15:14 +0000 (18:15 -0700)
commit344d89abf36b9ea559a4b25543bbc7d4206988f5
treec853d09d51cc0648eb7a1fba55fbe11c9399ef2b
parent9016a2a3dc4ee7e41ecda5a8b3a3d3481de94964
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.
src/bin/pg_waldump/pg_waldump.c