Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)
Date
Msg-id CAEudQApOsin4JVJG+4WjZnGTV7ikEq+13s0F6PwjtgKWrBgzKw@mail.gmail.com
Whole thread Raw
In response to Avoid incomplete copy string (src/backend/access/transam/xlog.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)
List pgsql-hackers
Em dom., 23 de jun. de 2024 às 22:05, Ranier Vilela <ranier.vf@gmail.com> escreveu:
Em dom., 23 de jun. de 2024 às 21:54, Michael Paquier <michael@paquier.xyz> escreveu:
On Sun, Jun 23, 2024 at 09:34:45PM -0300, Ranier Vilela wrote:
> It's not critical code, so I think it's ok to use strlen, even because the
> result of strlen will already be available using modern compilers.
>
> So, I think it's ok to use memcpy with strlen + 1.

It seems to me that there is a pretty good argument to just use
strlcpy() for the same reason as the one you cite: this is not a
performance-critical code, and that's just safer.
Yeah, I'm fine with strlcpy. I'm not against it.
Perhaps, like the v2?

Either v1 or v2, to me, looks good.

best regards,
Ranier Vilela
Attachment

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Parallel CREATE INDEX for GIN indexes
Next
From: Ranier Vilela
Date:
Subject: Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)