From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Replace remaining StrNCpy() by strlcpy() |
Date: | 2020-08-03 09:01:35 |
Message-ID: | CAApHDvoRuiXpca=KLi9R5MVzp+516QSgyrJg4Dj-3PU69e_Bfw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, 3 Aug 2020 at 18:59, Peter Eisentraut
<peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> I propose to replace the remaining uses of StrNCpy() with strlcpy() and
> remove the former. It's clear that strlcpy() has won the popularity
> contest, and the presence of the former is just confusing now.
It certainly would be good to get rid of some of these, but are some
of the changes not a bit questionable?
e.g:
@@ -4367,7 +4367,7 @@ pgstat_send_archiver(const char *xlog, bool failed)
*/
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_ARCHIVER);
msg.m_failed = failed;
- StrNCpy(msg.m_xlog, xlog, sizeof(msg.m_xlog));
+ strlcpy(msg.m_xlog, xlog, sizeof(msg.m_xlog));
msg.m_timestamp = GetCurrentTimestamp();
pgstat_send(&msg, sizeof(msg));
Will mean that we'll now no longer zero the full length of the m_xlog
field after the end of the string. Won't that mean we'll start writing
junk bytes to the stats collector?
David
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Sharma | 2020-08-03 09:05:38 | Re: recovering from "found xmin ... from before relfrozenxid ..." |
Previous Message | Peter Eisentraut | 2020-08-03 08:00:27 | Re: Confusing behavior of create table like |