Re: Replace remaining StrNCpy() by strlcpy()

2020-08-10 Thread Peter Eisentraut
On 2020-08-08 18:09, Tom Lane wrote: Peter Eisentraut writes: I removed namecpy() altogether because you can just use struct assignment. Makes sense, and I notice it was unused anyway. v3 passes eyeball examination (I didn't bother running tests), with only one remaining nit: the proposed co

Re: Replace remaining StrNCpy() by strlcpy()

2020-08-08 Thread Tom Lane
Peter Eisentraut writes: > I removed namecpy() altogether because you can just use struct assignment. Makes sense, and I notice it was unused anyway. v3 passes eyeball examination (I didn't bother running tests), with only one remaining nit: the proposed commit message says They are equ

Re: Replace remaining StrNCpy() by strlcpy()

2020-08-07 Thread Peter Eisentraut
265388a79269d2cf67cdfbe5a26a74f0f4a178 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 4 Aug 2020 15:16:37 +0200 Subject: [PATCH v3] Replace remaining StrNCpy() by strlcpy() They are equivalent, and strlcpy() has become the preferred spelling. Convert over the remaining cases. Remove StrN

Re: Replace remaining StrNCpy() by strlcpy()

2020-08-05 Thread David Rowley
On Tue, 4 Aug 2020 at 00:12, Tom Lane wrote: > > I wrote: > > David Rowley writes: > >> 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? > > > StrNCpy doesn't z

Re: Replace remaining StrNCpy() by strlcpy()

2020-08-05 Thread Tom Lane
Peter Eisentraut writes: > Okay, here is a new patch with improved implementations of namecpy() and > namestrcpy(). I didn't see any other places that relied on the > zero-filling behavior of strncpy(). I've looked through this patch, and I concur with your conclusion that noplace else is depe

Re: Replace remaining StrNCpy() by strlcpy()

2020-08-04 Thread Peter Eisentraut
ment, 24x7 Support, Remote DBA, Training & Services From 740866001613e9d6aa29f759085ea284c0d41c94 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 4 Aug 2020 15:16:37 +0200 Subject: [PATCH v2] Replace remaining StrNCpy() by strlcpy() They are equivalent, and strlcpy() has become the pr

Re: Replace remaining StrNCpy() by strlcpy()

2020-08-03 Thread Tom Lane
Peter Eisentraut writes: > On 2020-08-03 14:12, Tom Lane wrote: >> In the specific case of the stats collector, if you don't want >> to be sending junk bytes then you'd better be memset'ing the >> whole message buffer not just this string field. So I'm not >> sure that the argument has any force

Re: Replace remaining StrNCpy() by strlcpy()

2020-08-03 Thread Peter Eisentraut
On 2020-08-03 14:12, Tom Lane wrote: I wrote: David Rowley writes: 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? StrNCpy doesn't zero-fill the destination today

Re: Replace remaining StrNCpy() by strlcpy()

2020-08-03 Thread Tom Lane
I wrote: > David Rowley writes: >> 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? > StrNCpy doesn't zero-fill the destination today either (except for > the very

Re: Replace remaining StrNCpy() by strlcpy()

2020-08-03 Thread Tom Lane
David Rowley writes: > - StrNCpy(msg.m_xlog, xlog, sizeof(msg.m_xlog)); > + strlcpy(msg.m_xlog, xlog, sizeof(msg.m_xlog)); > 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 col

Re: Replace remaining StrNCpy() by strlcpy()

2020-08-03 Thread David Rowley
On Mon, 3 Aug 2020 at 18:59, Peter Eisentraut 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

Replace remaining StrNCpy() by strlcpy()

2020-08-03 Thread Peter Eisentraut
24x7 Support, Remote DBA, Training & Services From ae0540f02eedfcf7a2b31ea8570d6bd26b31ef19 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 3 Aug 2020 08:25:54 +0200 Subject: [PATCH] Replace remaining StrNCpy() by strlcpy() They are equivalent, and strlcpy() has become the preferred