[hardening-discuss] -Wformat and user-defined struct members called printf

Kees Cook kees at outflux.net
Fri Jun 20 06:32:27 UTC 2008


Hi Marcus,

On Fri, Jun 20, 2008 at 06:22:27AM +0200, Marcus Better wrote:
> I'm preparing a package for the upcoming version of ser, the SIP Express
> Router, and ran into trouble with -Wformat. The source defines a struct
> rpc_t containing a function pointer named "printf":
> 
> typedef struct rpc {
> /* ... */
>     rpc_printf_f printf;
> /* ... */
> } rpc_t;
> 
> This causes compilation errors:
> 
>   ratelimit.c:348: error: ‘rpc_t’ has no member named ‘__printf_chk’
> 
> Is there a workaround for this, short of renaming the function?

Hmm.  Are you also using -D_FORTIFY_SOURCE=2 ?  I wouldn't expect
-Wformat to produce the __printf_cfk rewrite, I think that's part of the
the glibc fortify stuff.  And unfortunately, I don't know of a solution
for that.  That's a bit of a unexpected effect!  :P

-Kees

-- 
Kees Cook                                            @outflux.net



More information about the hardening-discuss mailing list