[sldev] [HELP] [Linux] Warning while building 113976-RC

Carlo Wood carlo at alinoe.com
Wed Mar 11 21:27:08 PDT 2009


On Thu, Mar 12, 2009 at 01:11:42AM +0000, Opensource Obscure wrote:
> However, apparently I could work around that by adding a 
> "%s", 
> at line 93 (before " dialog_text") in
> linden/indra/linux_crash_logger/llcrashloggerlinux.cpp
> 
> I don't remember anymore what this error is due to. Wrong
> g++ version on my system? a non-fixed bug? A flag in the 
> building commands I'm not using? By the way, I'm so ignorant
> that I can't even understand either the problem or the workaround

If you do printf("%s", str), then you avoid a crash in
the case the 'str' contains a '%s' (or %d etc).

In theory printf(fmt) is correct if fmt is a char*
and does NEVER contain such formats. However, this has
been the cause of many crashes and exploits, so gcc/g++
has the option to give you a warning when a non-literal
format is being used. And correctly so, I believe it
is much better (and safer) to use "%s" as format in
such cases and pass the string 'fmt' as string parameter.

-- 
Carlo Wood <carlo at alinoe.com>


More information about the SLDev mailing list