Skip to content

Commit 52840d7

Browse files
committed
[PGPRO-5454] copying basedir to exclude the situation of overwriting memory in another thread
1 parent 14035b2 commit 52840d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/stream.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static time_t stream_stop_begin = 0;
4242
*/
4343
typedef struct
4444
{
45-
const char *basedir;
45+
char basedir[MAXPGPATH];
4646
PGconn *conn;
4747

4848
/*
@@ -638,7 +638,7 @@ start_WAL_streaming(PGconn *backup_conn, char *stream_dst_path, ConnectionOption
638638
//TODO Add a comment about this calculation
639639
stream_stop_timeout = stream_stop_timeout + stream_stop_timeout * 0.1;
640640

641-
stream_thread_arg.basedir = stream_dst_path;
641+
strncpy(stream_thread_arg.basedir, stream_dst_path, sizeof(stream_thread_arg.basedir));
642642

643643
/*
644644
* Connect in replication mode to the server.

0 commit comments

Comments
 (0)