From: | "Karl O(dot) Pinc" <kop(at)meme(dot)com> |
---|---|
To: | Gilles Darold <gilles(dot)darold(at)dalibo(dot)com> |
Cc: | Christoph Berg <myon(at)debian(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Patch to implement pg_current_logfile() function |
Date: | 2016-11-17 15:43:34 |
Message-ID: | 20161117094334.62d873e9@slate.meme.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Gilles,
On Sun, 30 Oct 2016 02:04:59 -0500
"Karl O. Pinc" <kop(at)meme(dot)com> wrote:
> Attached is a patch to be applied on top of your v10 patch
> which does basic fixup to logfile_writename().
I'm looking at the v13 patch and don't see a change I submitted
with a patch to v10. You wrote:
snprintf(tempfn, sizeof(tempfn), "%s",
CURRENT_LOG_FILENAME);
strcat(tempfn, ".tmp");
I patched to:
snprintf(tempfn, sizeof(tempfn), "%s.tmp",
CURRENT_LOG_FILENAME);
As long as you're doing a snprintf() there's no point
in "risking" a buffer overflow by a subsequent strcat().
(Not that you're likely to ever get a buffer overflow.)
And why make two calls instead of 1? That's what's
in my head.
Regards,
Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
From | Date | Subject | |
---|---|---|---|
Next Message | Kohei KaiGai | 2016-11-17 16:08:37 | Re: Use of pg_proc.probin is legal? |
Previous Message | Robert Haas | 2016-11-17 15:39:18 | Re: Parallel execution and prepared statements |