Re: pg_verifybackup: TAR format backup verification

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Amul Sul <sulamul(at)gmail(dot)com>, Sravan Kumar <sravanvcybage(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_verifybackup: TAR format backup verification
Date: 2024-10-01 12:45:32
Message-ID: CA+TgmoakvcYm8Ao7EbpAJhxZp_=YTEb33NZ_diFbd-mUe7Mnag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 30, 2024 at 6:05 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > On Mon, Sep 30, 2024 at 11:31 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> WFM, modulo the suggestion about changing data types.
>
> > I would prefer not to make the data type change here because it has
> > quite a few tentacles.
>
> I see your point for the function's "len" argument, but perhaps it's
> worth doing
>
> - int remaining;
> + size_t remaining;
>
> remaining = sizeof(ControlFileData) - mystreamer->control_file_bytes;
> memcpy(((char *) &mystreamer->control_file)
> + mystreamer->control_file_bytes,
> - data, Min(len, remaining));
> + data, Min((size_t) len, remaining));
>
> This is enough to ensure the Min() remains safe.

OK, done!

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2024-10-01 12:48:02 Re: Row pattern recognition
Previous Message Amit Kapila 2024-10-01 12:43:33 Re: Conflict detection for update_deleted in logical replication