#24 rollingfile appender segfault

closed-duplicate
nobody
None
5
2012-09-30
2011-01-07
Brian Keen
No

Using the rollingfile appender to log a string that contains a sequence of 'printf' formatting characters such as "%s" gives a segmentation fault.

I think the fault lies in the file appender_type_rollingfile.c:-

/* only attempt the write if the policy implem says I can */
if ( rc <= ROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG ) {
rc = fprintf(rfup->rfu_current_fp, a_event->evt_rendered_msg);
rfup->rfu_current_file_size += strlen(a_event->evt_rendered_msg);

The call to fprint() is missing a format string. It should be:-
rc = fprintf(rfup->rfu_current_fp, "%s", a_event->evt_rendered_msg);

Discussion

    • status: open --> closed-duplicate
     
  • Fixed in CVS HEAD (in issue #1924072). -- František