Specific String crashes logger. Reproducible
Brought to you by:
valtri
A specific String crashes logger. Reproducible every time and easy to test
Try to log this string below.
Example
log4c_category_log(logger, LOG4C_PRIORITY_INFO,
"BAS011ACAA01501170C10039True30$BookingTime \n $FirstName $LastName Id=$RPINTest Enter ID %m/%d/%Y%I:%M %pFalse0True-4806013943484001414911600FalseFalseFalse0");
Note that this crashes. The problem seems to stem from '%m/%d/%Y%I:%M %p' part of the text. I am happy to help to contribute but I need some pointers on where to look and how to get this tested.
Please assist, this is a critical bug. I simply had to remove some of the loggers.
/Z
You should use:
log4c_category_log(logger, LOG4C_PRIORITY_INFO, "%s", "any string with % here...");
The "%s" format string is needed also when logging string variable (as it can contains % characters too).
Also I recommend to switch on the warnings (-Wformat -Wformat-security, or -Wall -Wformat-security). gcc should catch this problem already during compilation.
that worked a lot better.
Thanks
/Z