Use pg_parse_lsn() for timeline history switchpoints

readTimeLineHistory() previously parsed WAL switchpoints in timeline
history files using sscanf("%X/%08X") into uint32 values. An
overlong high component could overflow, while an overlong low component
was truncated to its first eight digits. Trailing characters were also
ignored.

Extract the switchpoint token and use pg_parse_lsn() to validate and
convert it, requiring one to eight hexadecimal digits per component
with no trailing characters, as for pg_lsn input. This matches the
change to pg_rewind's history file parser in commit f31d6fbc31d.

Author: Jan Nidzwetzki <[email protected]>
Reviewed-by: Hayato Kuroda <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: 
https://postgr.es/m/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5ffb8c7409385c58e5c1abaa22ee77ba4c1b5c33

Modified Files
--------------
src/backend/access/transam/timeline.c | 37 +++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)

Reply via email to