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 <[email protected]>
Author: Ayush Tiwari <[email protected]>
Reviewed-by: Hayato Kuroda <[email protected]>
Reviewed-by: Jan Nidzwetzki <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion:
https://postgr.es/m/[email protected]
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(-)