pgsql: pg_verifybackup: Improve some error handling around strtoul() ca

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_verifybackup: Improve some error handling around strtoul() ca
Date: 2026-08-01 10:45:21
Message-ID: E1wq7DV-00000001Dvg-0Six@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)partin(dot)io>
Discussion: https://postgr.es/m/DKBS2Z9CGARC.2T07O6TJYSE8B@partin.io

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/355814931141537e51418a276c74e91283da9631

Modified Files
--------------
src/bin/pg_verifybackup/pg_verifybackup.c | 2 +-
src/bin/pg_verifybackup/t/005_bad_manifest.pl | 16 ++++++++++++++++
src/common/parse_manifest.c | 6 +++---
3 files changed, 20 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-08-01 19:41:44 pgsql: doc: Fix glossary entry for data checksums workers
Previous Message Melanie Plageman 2026-07-31 21:48:49 pgsql: Allow IO time to be counted without a matching IO operation in p