pgsql: Reject overlong LSN components in START_REPLICATION
pgsql: Reject overlong LSN components in START_REPLICATION
От:
Fujii Masao <fujii@postgresql.org>
Дата:
Reject overlong LSN components in START_REPLICATION
The replication command scanner accepts arbitrarily long hexadecimal
LSN components, but converts them with sscanf("%X/%08X") into uint32
values. An overlong high component can overflow, while an overlong low
component is truncated to its first eight digits. This can cause
START_REPLICATION to use a different WAL location from the one requested.
Use pg_parse_lsn() to validate and convert the complete LSN token,
requiring one to eight hexadecimal digits per component, as for pg_lsn
input. This applies to both physical and logical replication.
Reported-by: ♂π≌26218 <1991230470@qq.com>
Author: Ayush Tiwari
Reviewed-by: Hayato Kuroda
Reviewed-by: Jan Nidzwetzki
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/tencent_C6ED19DF1759CDD37E786F7EE0B5207D0009@qq.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/4a842a1d6570b0875fb705e6335a16b525cbbd79
Modified Files
--------------
src/backend/replication/repl_scanner.l | 6 ++----
src/test/recovery/t/006_logical_decoding.pl | 12 ++++++++++++
2 files changed, 14 insertions(+), 4 deletions(-)