Skip to content

Commit

Permalink
log: pass entire log as string using '%s' fmt to avoid fmt bugs.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan authored and edsiper committed Oct 2, 2023
1 parent 19b82e2 commit a859c36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion input/flb_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ void input_log_print_novar(void *plugin, int log_level, const char* message)
{
struct flbgo_input_plugin *p = plugin;
if (p->api->input_log_check(p->i_ins, log_level)) {
p->api->log_print(log_level, NULL, 0, message);
/* all formating is done in golang, avoid fmt string bugs. */
p->api->log_print(log_level, NULL, 0, "%s", message);
}
}

Expand Down
3 changes: 2 additions & 1 deletion output/flb_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ void output_log_print_novar(void *plugin, int log_level, const char* message)
{
struct flbgo_output_plugin *p = plugin;
if (p->api->output_log_check(p->o_ins, log_level)) {
p->api->log_print(log_level, NULL, 0, message);
/* all formating is done in golang, avoid fmt string bugs. */
p->api->log_print(log_level, NULL, 0, "%s", message);
}
}

Expand Down

0 comments on commit a859c36

Please sign in to comment.