]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pg_verifybackup: Improve some error handling around strtoul() calls master github/master
authorMichael Paquier <michael@paquier.xyz>
Sat, 1 Aug 2026 10:21:46 +0000 (19:21 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sat, 1 Aug 2026 10:21:46 +0000 (19:21 +0900)
commit355814931141537e51418a276c74e91283da9631
treeb9b01a5c4b279e29736089fc8e43f3e7e99d6306
parentc9a669492719db2fe45cd17259ae0fc3bc4d91c5
pg_verifybackup: Improve some error handling around strtoul() calls

Three code paths checking the size, timeline ID and system identifier
stored in a manifest now check for an empty value.  Values are always
expected in these parts of a backup banifest.  A couple of tests are
added to validate this behavior

Additionally, precheck_tar_backup_file() checked that "endptr" is NULL.
Based on the C standard, strtoul() never sets an "endptr" to NULL when
given a value (that is the case here), returning a pointer to the
original value if there is nothing to convert.  The pre-tar validation
code is adjusted to do so.

Author: Tristan Partin <tristan@partin.io>
Discussion: https://postgr.es/m/DKBS2Z9CGARC.2T07O6TJYSE8B@partin.io
src/bin/pg_verifybackup/pg_verifybackup.c
src/bin/pg_verifybackup/t/005_bad_manifest.pl
src/common/parse_manifest.c