]> git.itanic.dy.fi Git - rrdd/blobdiff - plugin_manager.c
onewire_parser.c: Fix compiler warnings about string lengths
[rrdd] / plugin_manager.c
index 6ddac4cda4bf3ff3130a21bccd24e333af54ed3b..e13e01f7d11b8175c7b9e72eb1ce53f809a14e0f 100644 (file)
@@ -7,6 +7,7 @@
 #include "plugin.h"
 #include "debug.h"
 #include "version.h"
+#include "utils.h"
 
 static char *exec_path;
 
@@ -80,14 +81,16 @@ int load_parser_plugin(const char *name)
        int ret;
 
        strncpy(str, name, sizeof(str));
-       strncat(str, parser, sizeof(str) - 1);
+       str[sizeof(str) - 1] = '\0';
+       _strlcat(str, parser, sizeof(str));
        ret = load_plugin(str);
        if (!ret)
                return 0;
 
        strncpy(str, "./", sizeof(str));
-       strncat(str, name, sizeof(str) - 1);
-       strncat(str, parser, sizeof(str) - 1);
+       str[sizeof(str) - 1] = '\0';
+       _strlcat(str, name, sizeof(str));
+       _strlcat(str, parser, sizeof(str));
        ret = load_plugin(str);
        if (!ret)
                return 0;
@@ -96,8 +99,9 @@ int load_parser_plugin(const char *name)
                return 0;
 
        strncpy(str, exec_path, sizeof(str));
-       strncat(str, "/", sizeof(str) - 1);
-       strncat(str, name, sizeof(str) - 1);
-       strncat(str, parser, sizeof(str) - 1);
+       str[sizeof(str) - 1] = '\0';
+       _strlcat(str, "/", sizeof(str));
+       _strlcat(str, name, sizeof(str));
+       _strlcat(str, parser, sizeof(str));
        return load_plugin(str);
 }