Re: Some doubious code in pgstat.c

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Some doubious code in pgstat.c
Date: 2020-11-05 06:18:24
Message-ID: CAA4eK1+xFnv06zraQdTLzQ4PUBSaVqsPtw561i_G8DCptjRnLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 5, 2020 at 9:44 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> On Thu, Nov 5, 2020 at 11:18 AM Kyotaro Horiguchi
> <horikyota(dot)ntt(at)gmail(dot)com> wrote:
> > As another issue, just replace memcpy with strlcpy makes compiler
> > complain of type mismatch, as the first paramter to memcpy had an
> > needless "&" operator. I removed it in this patch.
> >
> > (&msg.m_slotname is a "char (*)[NAMEDATALEN]", not a "char *".)
> >
>
> The patch looks good to me.
>

LGTM as well but the proposed commit message seems to be a bit
unclear. How about something like this:
"Use strlcpy instead of memcpy for copying the slot name in pgstat.c.

There is no outright bug here but it is better to be consistent with
the usage at other places in the same file. In the passing, fix a wrong
Assertion in pgstat_recv_replslot."

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-11-05 06:41:23 Re: scram-sha-256 broken with FIPS and OpenSSL 1.0.2
Previous Message Amit Kapila 2020-11-05 05:37:21 Re: [Patch] Optimize dropping of relation buffers using dlist