From: David Steele <david@pgmasters.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Teodor Sigaev <teodor@sigaev.ru>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Exclude unlogged tables from base backups
Date: Sun, 25 Mar 2018 15:59:22 -0400
Message-ID: <182a8752-59d1-1f12-5f12-ccb6f7f5fc6e@pgmasters.net> (raw)
In-Reply-To: <5114.1522007696@sss.pgh.pa.us>
References: <E1ezPKi-00081N-FP@gemulon.postgresql.org>
<14453.1522001792@sss.pgh.pa.us>
<8d57c3ba-d44b-a8eb-7a91-c0b6156240fd@pgmasters.net>
<3587.1522005723@sss.pgh.pa.us>
<cf8a4117-0b15-9755-0af6-9eae53857fa7@pgmasters.net>
<5114.1522007696@sss.pgh.pa.us>
On 3/25/18 3:54 PM, Tom Lane wrote:
> David Steele <david@pgmasters.net> writes:
>> On 3/25/18 3:22 PM, Tom Lane wrote:
>>> Actually, that code didn't guarantee zero termination under *any*
>>> circumstances; it only happened to work if the stack contained
>>> zeroes to start with.
>
>> Interesting. strncpy() says it will pad the destination with NULLs when
>> src is less than the size provided. Perhaps some compilers don't honor
>> that?
>
> Yeah, but the "size provided" was the number of characters to be copied
> from the source string, not the size of the destination buffer. So
> strncpy didn't think it needed to add any nulls. There's a reason why
> that function is widely disliked --- it's hard to use it in a safe way.
Whoops, how right you are. I'm generally passing destination buffer
size in these cases and totally misread what this was doing.
--
-David
david@pgmasters.net
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: david@pgmasters.net, tgl@sss.pgh.pa.us, teodor@sigaev.ru
Subject: Re: pgsql: Exclude unlogged tables from base backups
In-Reply-To: <182a8752-59d1-1f12-5f12-ccb6f7f5fc6e@pgmasters.net>
References: <E1ezPKi-00081N-FP@gemulon.postgresql.org> <14453.1522001792@sss.pgh.pa.us> <8d57c3ba-d44b-a8eb-7a91-c0b6156240fd@pgmasters.net> <3587.1522005723@sss.pgh.pa.us> <cf8a4117-0b15-9755-0af6-9eae53857fa7@pgmasters.net> <5114.1522007696@sss.pgh.pa.us> <182a8752-59d1-1f12-5f12-ccb6f7f5fc6e@pgmasters.net>
* 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