Replace all occurrences of `strcpy' with `sstrncpy'.
[collectd.git] / src / mbmon.c
index bad1a38..22a26da 100644 (file)
@@ -228,8 +228,8 @@ static void mbmon_submit (const char *type, const char *type_instance,
        vl.values = values;
        vl.values_len = 1;
        vl.time = time (NULL);
-       strcpy (vl.host, hostname_g);
-       strcpy (vl.plugin, "mbmon");
+       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.plugin, "mbmon", sizeof (vl.plugin));
        strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
 
        plugin_dispatch_values (type, &vl);
@@ -240,7 +240,7 @@ static void trim_spaces (char *s)
 {
        size_t l;
 
-       for (l = strlen (s) - 1; (l > 0) && isspace (s[l]); l--)
+       for (l = strlen (s) - 1; (l > 0) && isspace ((int) s[l]); l--)
                s[l] = '\0';
 }