public inbox for [email protected]
help / color / mirror / Atom feedFrom: Michael Paquier <[email protected]>
To: Ranier Vilela <[email protected]>
Cc: FabrÃzio de Royes Mello <[email protected]>
Cc: Pg Hackers <[email protected]>
Subject: Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)
Date: Mon, 24 Jun 2024 09:53:52 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAEudQAoED8DCDxfpGmZzjw+jCEd+0aTvCf=cComZsRjENW05HQ@mail.gmail.com>
References: <CAEudQApAsbLsQ+gGiw-hT+JwGhgogFa_=5NUkgFO6kOPxyNidQ@mail.gmail.com>
<CAFcNs+p2NSyT0Vs2gFxGwFn02jEj_DgHWK0N-F18EtENh-8TEw@mail.gmail.com>
<[email protected]>
<CAEudQAoED8DCDxfpGmZzjw+jCEd+0aTvCf=cComZsRjENW05HQ@mail.gmail.com>
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.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../[email protected]/2-signature.asc)
download
view thread (4+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox