Merge branch 'collectd-4.4'
[collectd.git] / src / utils_cmd_putval.c
index 8fbc8de..9cbba12 100644 (file)
@@ -170,13 +170,13 @@ int handle_putval (FILE *fh, char **fields, int fields_num)
                return (-1);
        }
 
-       strcpy (vl.host, hostname);
-       strcpy (vl.plugin, plugin);
+       sstrncpy (vl.host, hostname, sizeof (vl.host));
+       sstrncpy (vl.plugin, plugin, sizeof (vl.plugin));
+       sstrncpy (vl.type, type, sizeof (vl.type));
        if (plugin_instance != NULL)
-               strcpy (vl.plugin_instance, plugin_instance);
-       strcpy (vl.type, type);
+               sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
        if (type_instance != NULL)
-               strcpy (vl.type_instance, type_instance);
+               sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
 
        ds = plugin_get_ds (type);
        if (ds == NULL) {