mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-06 20:26:52 +02:00
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 infc49e24fa6
. Found by UBSan, run locally. Backpatch: 11-, likefc49e24fa6
itself.
This commit is contained in:
parent
5ca2aa2f26
commit
5ebd262dcb
@ -180,7 +180,7 @@ search_directory(const char *directory, const char *fname)
|
|||||||
if (IsXLogFileName(xlde->d_name))
|
if (IsXLogFileName(xlde->d_name))
|
||||||
{
|
{
|
||||||
fd = open_file_in_directory(directory, xlde->d_name);
|
fd = open_file_in_directory(directory, xlde->d_name);
|
||||||
fname = xlde->d_name;
|
fname = pg_strdup(xlde->d_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user