You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Igor Galić <i....@brainsware.org> on 2011/10/05 16:50:45 UTC

ap_log_error wants a string literal in mod_lua

Hey folks,

When trunk with (hardened) gcc 4.6 on Ubuntu beta, I get:

lua_config.c: In function 'cmd_log_at':
lua_config.c:177:5: error: format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors


The appropriate source:
    lua_Debug dbg;
    
    lua_getstack(L, 1, &dbg);
    lua_getinfo(L, "Sl", &dbg);
    
    msg = luaL_checkstring(L, 2);
    ap_log_error(dbg.source, dbg.currentline, APLOG_MODULE_INDEX, level, 0, cmd->server, msg);


Is there anything we can do to fix this so it builds again with paranoia options?

So long,

i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 571B 8B8A FC97 266D BDA3  EF6F 43AD 80A4 5779 3257

Re: ap_log_error wants a string literal in mod_lua

Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Fri, 7 Oct 2011, Igor Galić wrote:
>> How about:
>>
>> ap_log_error(dbg.source, dbg.currentline, APLOG_MODULE_INDEX, level,
>> 0, cmd->server, "%s", msg);
>
> appears in one more place -- if you're fine with this solution,
> I'll commit it.

If have committed it already because I have now set 
-Werror=format-security by default in maintainer mode. Sorry for being 
impatient ;-)

Re: ap_log_error wants a string literal in mod_lua

Posted by Igor Galić <i....@brainsware.org>.
> > When trunk with (hardened) gcc 4.6 on Ubuntu beta, I get:
> > 
> > lua_config.c: In function 'cmd_log_at':
> > lua_config.c:177:5: error: format not a string literal and no
> > format arguments [-Werror=format-security]
> > cc1: some warnings being treated as errors
> > 
> > 
> > The appropriate source:
> >     lua_Debug dbg;
> >     
> >     lua_getstack(L, 1, &dbg);
> >     lua_getinfo(L, "Sl", &dbg);
> >     
> >     msg = luaL_checkstring(L, 2);
> >     ap_log_error(dbg.source, dbg.currentline,
> > APLOG_MODULE_INDEX, level, 0, cmd->server, msg);
> > 
> > 
> > Is there anything we can do to fix this so it builds again
> > with paranoia options?
> 
> How about:
> 
> ap_log_error(dbg.source, dbg.currentline, APLOG_MODULE_INDEX, level,
> 0, cmd->server, "%s", msg);

appears in one more place -- if you're fine with this solution,
I'll commit it.
 
> Regards
> 
> Rüdiger

i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 571B 8B8A FC97 266D BDA3  EF6F 43AD 80A4 5779 3257

RE: ap_log_error wants a string literal in mod_lua

Posted by "Plüm, Rüdiger, VF-Group" <ru...@vodafone.com>.
 

> -----Original Message-----
> From: Igor Galić [mailto:i.galic@brainsware.org] 
> Sent: Mittwoch, 5. Oktober 2011 16:51
> To: dev 
> Subject: ap_log_error wants a string literal in mod_lua
> 
> 
> Hey folks,
> 
> When trunk with (hardened) gcc 4.6 on Ubuntu beta, I get:
> 
> lua_config.c: In function 'cmd_log_at':
> lua_config.c:177:5: error: format not a string literal and no 
> format arguments [-Werror=format-security]
> cc1: some warnings being treated as errors
> 
> 
> The appropriate source:
>     lua_Debug dbg;
>     
>     lua_getstack(L, 1, &dbg);
>     lua_getinfo(L, "Sl", &dbg);
>     
>     msg = luaL_checkstring(L, 2);
>     ap_log_error(dbg.source, dbg.currentline, 
> APLOG_MODULE_INDEX, level, 0, cmd->server, msg);
> 
> 
> Is there anything we can do to fix this so it builds again 
> with paranoia options?

How about:

ap_log_error(dbg.source, dbg.currentline, APLOG_MODULE_INDEX, level, 0, cmd->server, "%s", msg);

Regards

Rüdiger