Skip to content

Commit 264d284

Browse files
committed
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 fc49e24. Found by UBSan, run locally. Backpatch: 11-, like fc49e24 itself.
1 parent cc7401d commit 264d284

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/bin/pg_waldump/pg_waldump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ search_directory(const char *directory, const char *fname)
204204
if (IsXLogFileName(xlde->d_name))
205205
{
206206
fd = open_file_in_directory(directory, xlde->d_name);
207-
fname = xlde->d_name;
207+
fname = pg_strdup(xlde->d_name);
208208
break;
209209
}
210210
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy