aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-03-17 16:10:38 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-03-17 16:10:38 -0400
commit217815c66987704ef5139772a8fd05fd7c361e1a (patch)
treee12af6cd9a7019b3a50535517eaa9d72685e8f41 /src
parent492f6e21038a821511600fc174a128d3af036d37 (diff)
downloadpostgresql-217815c66987704ef5139772a8fd05fd7c361e1a.tar.gz
postgresql-217815c66987704ef5139772a8fd05fd7c361e1a.zip
Prevent buffer overrun in read_tablespace_map().
Robert Foggia of Trustwave reported that read_tablespace_map() fails to prevent an overrun of its on-stack input buffer. Since the tablespace map file is presumed trustworthy, this does not seem like an interesting security vulnerability, but still we should fix it just in the name of robustness. While here, document that pg_basebackup's --tablespace-mapping option doesn't work with tar-format output, because it doesn't. To make it work, we'd have to modify the tablespace_map file within the tarball sent by the server, which might be possible but I'm not volunteering. (Less-painful solutions would require changing the basebackup protocol so that the source server could adjust the map. That's not very appetizing either.)
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xlog.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 9c72fe711bd..42b902b298b 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -11626,7 +11626,7 @@ read_tablespace_map(List **tablespaces)
}
else if ((ch == '\n' || ch == '\r') && prev_ch == '\\')
str[i - 1] = ch;
- else
+ else if (i < sizeof(str) - 1)
str[i++] = ch;
prev_ch = ch;
}