From a859c368e12c3f07657c255039f8ef377f53a6f3 Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Fri, 29 Sep 2023 16:09:40 -0300 Subject: [PATCH] log: pass entire log as string using '%s' fmt to avoid fmt bugs. Signed-off-by: Phillip Whelan --- input/flb_input.h | 3 ++- output/flb_output.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/input/flb_input.h b/input/flb_input.h index 62760b7..ba91419 100644 --- a/input/flb_input.h +++ b/input/flb_input.h @@ -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); } } diff --git a/output/flb_output.h b/output/flb_output.h index 76fe881..262cd0b 100644 --- a/output/flb_output.h +++ b/output/flb_output.h @@ -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); } }