From 67a926821b3b6e39d9fd5e1c10b5a2d0ecdd237a Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sat, 6 Dec 2008 17:29:42 +0100 Subject: [PATCH] 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. --- src/perl.c | 2 +- src/utils_complain.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 : */ -- 2.11.0