aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2022-12-12 10:17:02 -0500
committerRobert Haas <rhaas@postgresql.org>2022-12-12 10:26:48 -0500
commit45f5c81ad2bc2cd4e6a4fa0ba13b34f5c6048d44 (patch)
treeabd25e6f74cca0c3f7798c90aefa8910763985d2 /src
parentdf8b8968d4095f44acd6de03b4add65f9709b79d (diff)
downloadpostgresql-45f5c81ad2bc2cd4e6a4fa0ba13b34f5c6048d44.tar.gz
postgresql-45f5c81ad2bc2cd4e6a4fa0ba13b34f5c6048d44.zip
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 bef47ff85df18bf4a3a9b13bd2a54820e27f3614 introduced this problem. Report and patch by Antonin Houska. Discussion: http://postgr.es/m/15764.1670528645@antos
Diffstat (limited to 'src')
-rw-r--r--src/backend/backup/basebackup.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/backend/backup/basebackup.c b/src/backend/backup/basebackup.c
index 74fb5293806..7aa5f6e44d1 100644
--- a/src/backend/backup/basebackup.c
+++ b/src/backend/backup/basebackup.c
@@ -1073,6 +1073,7 @@ sendFileWithContent(bbsink *sink, const char *filename, const char *content,
memcpy(sink->bbs_buffer, content, nbytes);
bbsink_archive_contents(sink, nbytes);
bytes_done += nbytes;
+ content += nbytes;
}
_tarWritePadding(sink, len);