Re: Fixes for compiler warnings - Mailing list pgsql-hackers

From Jeroen Vermeulen
Subject Re: Fixes for compiler warnings
Date
Msg-id 4975F54F.4000703@xs4all.nl
Whole thread Raw
In response to Re: Fixes for compiler warnings  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut wrote:

> -Wformat-security warns about
> 
>     printf(var);
> 
> but not about
> 
>     printf(var, a);
> 
> I don't understand that; the crash or exploit potential is pretty much the 
> same in both cases.

Not sure this is the reason, but in the first case any risk is trivially 
avoided by using puts() or printf("%s", var) instead.  So printf(var) is 
almost certainly not what you mean.

I think that's a reasonable warning to have enabled, whereas the other 
one is more of a "try it sometime, you might find something" kind of 
warning.


Jeroen


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: FWD: Re: Updated backslash consistency patch
Next
From: "Merlin Moncure"
Date:
Subject: Re: is 8.4 array_agg() supposed to work with array values?