diff options
author | Robert Haas <rhaas@postgresql.org> | 2024-10-01 08:31:33 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2024-10-01 08:36:54 -0400 |
commit | fc1b2ce0ee9c9745c5c562b692e021344a3f719a (patch) | |
tree | 41c4cb8e62e734e999aa485259e2b4fba9fcfe96 /src/bin/pg_verifybackup/pg_verifybackup.c | |
parent | 9c2a6c5a5f4b94a93120009e623ae8bd153e6dbb (diff) | |
download | postgresql-fc1b2ce0ee9c9745c5c562b692e021344a3f719a.tar.gz postgresql-fc1b2ce0ee9c9745c5c562b692e021344a3f719a.zip |
Fix some pg_verifybackup issues reported by Coverity.
Commit 8dfd3129027969fdd2d9d294220c867d2efd84aa introduced a few
problems. verify_tar_file() forgot to free a buffer; the leak can't
add up to anything material, but might as well fix it.
precheck_tar_backup_file() intended to return after reporting an
error but didn't actually do so. member_copy_control_data() could
try to copy zero bytes (and maybe Coverity thinks it can even be
trying to copy a negative number of bytes).
Per discussion with Tom Lane.
Discussion: http://postgr.es/m/1240823.1727629418@sss.pgh.pa.us
Diffstat (limited to 'src/bin/pg_verifybackup/pg_verifybackup.c')
-rw-r--r-- | src/bin/pg_verifybackup/pg_verifybackup.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c index a9d41a6b838..32467a1ba09 100644 --- a/src/bin/pg_verifybackup/pg_verifybackup.c +++ b/src/bin/pg_verifybackup/pg_verifybackup.c @@ -929,9 +929,12 @@ precheck_tar_backup_file(verifier_context *context, char *relpath, * result is 0, or if the value is too large to be a valid OID. */ if (suffix == NULL || num <= 0 || num > OID_MAX) + { report_backup_error(context, "file \"%s\" is not expected in a tar format backup", relpath); + return; + } tblspc_oid = (Oid) num; } @@ -1014,6 +1017,8 @@ verify_tar_file(verifier_context *context, char *relpath, char *fullpath, progress_report(false); } + pg_free(buffer); + if (rc < 0) report_backup_error(context, "could not read file \"%s\": %m", relpath); |