Merge branch 'collectd-4.4'
[collectd.git] / src / memcached.c
index ca93102..ddea2ea 100644 (file)
@@ -223,8 +223,8 @@ static void submit_counter (const char *type, const char *type_inst,
        vl.values = values;
        vl.values_len = 1;
        vl.time = time (NULL);
-       strcpy (vl.host, hostname_g);
-       strcpy (vl.plugin, "memcached");
+       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.plugin, "memcached", sizeof (vl.plugin));
        sstrncpy (vl.type, type, sizeof (vl.type));
        if (type_inst != NULL)
                sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
@@ -245,8 +245,8 @@ static void submit_counter2 (const char *type, const char *type_inst,
        vl.values = values;
        vl.values_len = 2;
        vl.time = time (NULL);
-       strcpy (vl.host, hostname_g);
-       strcpy (vl.plugin, "memcached");
+       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.plugin, "memcached", sizeof (vl.plugin));
        sstrncpy (vl.type, type, sizeof (vl.type));
        if (type_inst != NULL)
                sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
@@ -266,8 +266,8 @@ static void submit_gauge (const char *type, const char *type_inst,
        vl.values = values;
        vl.values_len = 1;
        vl.time = time (NULL);
-       strcpy (vl.host, hostname_g);
-       strcpy (vl.plugin, "memcached");
+       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.plugin, "memcached", sizeof (vl.plugin));
        sstrncpy (vl.type, type, sizeof (vl.type));
        if (type_inst != NULL)
                sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
@@ -288,8 +288,8 @@ static void submit_gauge2 (const char *type, const char *type_inst,
        vl.values = values;
        vl.values_len = 2;
        vl.time = time (NULL);
-       strcpy (vl.host, hostname_g);
-       strcpy (vl.plugin, "memcached");
+       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.plugin, "memcached", sizeof (vl.plugin));
        sstrncpy (vl.type, type, sizeof (vl.type));
        if (type_inst != NULL)
                sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));