Skip to content

Commit 8b5ba2f

Browse files
committed
Fix failure to advance content pointer in sendFileWithContent.
If sendFileWithContent were used to send a file larger than the bbsink buffer size, this would result in corruption. The only files that are sent via sendFileWithContent are the backup label file, the tablespace map file, and .done files for WAL segments included in the backup. Of these, it seems that only the tablespace_map file can become large enough to cause a problem, and then only if you have a lot of tablespaces. If you do have that situation, you might end up with a corrupted tablespace_map file, which would be bad. My commit bef47ff introduced this problem. Report and patch by Antonin Houska. Discussion: http://postgr.es/m/15764.1670528645@antos
1 parent 04788ee commit 8b5ba2f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/backend/backup/basebackup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,7 @@ sendFileWithContent(bbsink *sink, const char *filename, const char *content,
10571057
memcpy(sink->bbs_buffer, content, nbytes);
10581058
bbsink_archive_contents(sink, nbytes);
10591059
bytes_done += nbytes;
1060+
content += nbytes;
10601061
}
10611062

10621063
_tarWritePadding(sink, len);

0 commit comments

Comments
 (0)