mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03: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:
@ -177,7 +177,7 @@ search_directory(const char *directory, const char *fname)
|
||||
if (IsXLogFileName(xlde->d_name))
|
||||
{
|
||||
fd = open_file_in_directory(directory, xlde->d_name);
|
||||
fname = xlde->d_name;
|
||||
fname = pg_strdup(xlde->d_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user