From: Sebastian Harl Date: Sat, 6 Dec 2008 16:29:42 +0000 (+0100) Subject: perl plugin, utils_complain: Fixed errors identified by -Wformat-security. X-Git-Tag: collectd-4.5.2~6 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=67a926821b3b6e39d9fd5e1c10b5a2d0ecdd237a;ds=sidebyside perl plugin, utils_complain: Fixed errors identified by -Wformat-security. A few "format not a string literal and no format arguments" errors have been fixed by using "%s" as the format argument. Thanks to Kevin (onebinary) for reporting this. --- diff --git a/src/perl.c b/src/perl.c index 400057b7..343c83ae 100644 --- a/src/perl.c +++ b/src/perl.c @@ -1092,7 +1092,7 @@ static XS (Collectd_plugin_log) XSRETURN_EMPTY; } - plugin_log (SvIV (ST (0)), SvPV_nolen (ST (1))); + plugin_log (SvIV (ST (0)), "%s", SvPV_nolen (ST (1))); XSRETURN_YES; } /* static XS (Collectd_plugin_log) */ diff --git a/src/utils_complain.c b/src/utils_complain.c index d5c09964..9074b183 100644 --- a/src/utils_complain.c +++ b/src/utils_complain.c @@ -50,7 +50,7 @@ static int vcomplain (int level, c_complain_t *c, vsnprintf (message, sizeof (message), format, ap); message[sizeof (message) - 1] = '\0'; - plugin_log (level, message); + plugin_log (level, "%s", message); return 1; } /* vcomplain */ @@ -95,7 +95,7 @@ void c_do_release (int level, c_complain_t *c, const char *format, ...) message[sizeof (message) - 1] = '\0'; va_end (ap); - plugin_log (level, message); + plugin_log (level, "%s", message); } /* c_release */ /* vim: set sw=4 ts=4 tw=78 noexpandtab : */