| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | David Steele <david(at)pgmasters(dot)net> |
| Cc: | Teodor Sigaev <teodor(at)sigaev(dot)ru>, pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: pgsql: Exclude unlogged tables from base backups |
| Date: | 2018-03-25 19:54:56 |
| Message-ID: | 5114.1522007696@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
David Steele <david(at)pgmasters(dot)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.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Steele | 2018-03-25 19:59:22 | Re: pgsql: Exclude unlogged tables from base backups |
| Previous Message | David Steele | 2018-03-25 19:46:48 | Re: pgsql: Exclude unlogged tables from base backups |