X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fplugin.c;h=61cc09c6251500c275ddee80582cd7bcbb8f7bab;hb=f50ada19dcd0dc6185dc4b410e721d46d1caba9f;hp=9d558cb1941f54df06ed2523398c0ae61abd4c62;hpb=b72d521340383b6418fa6a75faca3bc45f06b14a;p=collectd.git diff --git a/src/plugin.c b/src/plugin.c index 9d558cb1..61cc09c6 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -328,6 +328,7 @@ int plugin_load (const char *type) int ret; struct stat statbuf; struct dirent *de; + int status; DEBUG ("type = %s", type); @@ -336,8 +337,8 @@ int plugin_load (const char *type) /* `cpu' should not match `cpufreq'. To solve this we add `.so' to the * type when matching the filename */ - if (ssnprintf (typename, sizeof (typename), - "%s.so", type) >= sizeof (typename)) + status = ssnprintf (typename, sizeof (typename), "%s.so", type); + if ((status < 0) || ((size_t) status >= sizeof (typename))) { WARNING ("snprintf: truncated: `%s.so'", type); return (-1); @@ -357,8 +358,9 @@ int plugin_load (const char *type) if (strncasecmp (de->d_name, typename, typename_len)) continue; - if (ssnprintf (filename, sizeof (filename), - "%s/%s", dir, de->d_name) >= sizeof (filename)) + status = ssnprintf (filename, sizeof (filename), + "%s/%s", dir, de->d_name); + if ((status < 0) || ((size_t) status >= sizeof (filename))) { WARNING ("snprintf: truncated: `%s/%s'", dir, de->d_name); continue;