Re: -Wformat-nonliteral

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: -Wformat-nonliteral
Date: 2026-11-30 15:33:31
Message-ID: a6c5f563-654c-4c35-b4e9-f4bac8fe4799@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2026-11-13 Fr 5:37 AM, Peter Eisentraut wrote:
> This is a follow-up to CVE-2026-16240 (commit 4a18e9b5f36).
>
> That issue was found by -Wformat-nonliteral.  That warning option
> flags a bunch of other places, which were fortunately not security
> issues.  I think this is quite a large surface area to leave
> unchecked.  I propose to fix these and turn this warning option on by
> default.  While this does require introducing a bit more duplication,
> the patch (see patch 0003) overall does not blow up the code much at
> all (911 insertions(+), 896 deletions(-)).
>
> This also runs into some workarounds we had installed for strftime by
> explicitly *not* using literal format strings.  The y2k-related one of
> these is definitely obsolete and can be removed (see patch 0001).  The
> MinGW-related one (see patch 0002) is also obsolescent if we want to
> assume gcc 14+ for MinGW.  I think for MinGW we tend to opt for only
> supporting recent toolchains, so this might be ok.  Otherwise, we
> could work around this with some pragmas.

The only buildfarm animal doing mingw is fairywren, and it's using UCRT
with gcc-16.2. So from that POV I think patches 0001 and 0002 should be
fine.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2026-11-30 16:10:30 Re: Allow progress tracking of sub-commands
Previous Message Daniel Gustafsson 2026-11-30 15:11:43 Re: passwordcheck: Make the user name check case-insensitive