From: Daniel Gustafsson <daniel@yesql.se>
To: David Rowley <dgrowleyml@gmail.com>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Add missing string terminator
Date: Wed, 30 Apr 2025 13:27:18 +0200
Message-ID: <9887D3A8-A74F-4836-BC57-74AC4AE901BB@yesql.se> (raw)
In-Reply-To: <CAApHDvrg3Gz6kF76Feyc6Dyi9u7iS+vcdQw3VZgGA1+wUc=wRQ@mail.gmail.com>
References: <E1uA3rI-000Ibx-19@gemulon.postgresql.org>
<CAApHDvrg3Gz6kF76Feyc6Dyi9u7iS+vcdQw3VZgGA1+wUc=wRQ@mail.gmail.com>
> On 30 Apr 2025, at 12:57, David Rowley <dgrowleyml@gmail.com> wrote:
>
> On Wed, 30 Apr 2025 at 21:36, Daniel Gustafsson
> <dgustafsson@postgresql.org> wrote:
>> Add missing string terminator
>
> A possible minor niggle. Would memcpy not be a more suitable function
> for this?
How about using strlcpy as suggested by Peter?
- strncpy(nameptr, "Remaining Totals", namelen);
- nameptr[namelen] = '\0';
+ strlcpy(nameptr, "Remaining Totals", namelen + 1);
--
Daniel Gustafsson
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: daniel@yesql.se, dgrowleyml@gmail.com
Subject: Re: pgsql: Add missing string terminator
In-Reply-To: <9887D3A8-A74F-4836-BC57-74AC4AE901BB@yesql.se>
References: <E1uA3rI-000Ibx-19@gemulon.postgresql.org> <CAApHDvrg3Gz6kF76Feyc6Dyi9u7iS+vcdQw3VZgGA1+wUc=wRQ@mail.gmail.com> <9887D3A8-A74F-4836-BC57-74AC4AE901BB@yesql.se>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox