Hi,
this has been fixed in log4c 1.2.2 already (the current version is
1.2.4).
I think there should be no such error anymore - this type of errors can
be detected by the compiler ("-Wformat -Wformat-security" in CFLAGS),
and most Linux distributions use these compilation flags.
Cheers,
Frantisek
On Wed, 2015-12-09 at 16:01 +0100, Klaus-Günter Höft wrote:
> Hi,
>
> I wanted to log the format chosen to use by 'fprintf()'.
> The format alternatives are "-N '%s'" or "-T '%s'".
>
> The program crashes with a core dump.
> After some debugging I found the cause:
> In the file "appender_type_rollingfile.c" the following statement
> is used the put the rendered message into the log file:
>
> rc = fprintf(rfup->rfu_current_fp,
> a_event->evt_rendered_msg);
>
> This does not work because the rendered message contains the chosen
> format (e.g.: "-N '%s'")
> and the function 'fprintf()' looks for an argument matching the
> conversion specification "%s".
>
> The following statement would work:
>
> rc = fprintf(rfup->rfu_current_fp, "%s",
> a_event->evt_rendered_msg);
> or:
> rc = fputs(a_event->evt_rendered_msg, rfup->rfu_current_fp);
>
>
> This situation may also apply to other appenders.
>
> Best regards
> Klaus-Günter Höft
> --
> Klaus-Günter Höft
> System Architect
>
> Werum Software & Systems AG
> Wulf-Werum-Straße 3
> 21337 Lüneburg
>
> Tel: +49 4131 8307-570
> Fax: +49 4131 8307-200
> Mail: kla...@we...
> Web: http://www.werum.de
>
> USt-ID-Nr. DE 293 571 381
> Sitz der Gesellschaft: Lüneburg
> RG Lüneburg HRB 204846
> Vorsitzender des Aufsichtsrats: Dr. Hans Windauer
> Vorstand: Christian Sommer (Vorsitzender), Thomas Menge, Carsten Stein
> ------------------------------------------------------------------------------
> _______________________________________________
> Log4c-devel mailing list
> Log...@li...
> https://lists.sourceforge.net/lists/listinfo/log4c-devel
|