On Mon, 3 Aug 2020 at 18:59, Peter Eisentraut <peter.eisentr...@2ndquadrant.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