summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c6bbc09)
raw | patch | inline | side by side (parent: c6bbc09)
author | Florian Forster <sifnfors@informatik.stud.uni-erlangen.de> | |
Wed, 11 Jun 2008 12:29:31 +0000 (14:29 +0200) | ||
committer | Florian Forster <sifnfors@informatik.stud.uni-erlangen.de> | |
Wed, 11 Jun 2008 12:29:31 +0000 (14:29 +0200) |
43 files changed:
diff --git a/src/apache.c b/src/apache.c
index 2a7e0b80cc41ef0e0bf912dab58895bb88b8ee56..54a5d562a31043714100b131b272efdd171c4757 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "apache");
- strcpy (vl.plugin_instance, "");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "apache", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
if (type_instance != NULL)
{
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "apache");
- strcpy (vl.plugin_instance, "");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "apache", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
if (type_instance != NULL)
{
diff --git a/src/apcups.c b/src/apcups.c
index 5a03764f59f5ea53bc1ac63cd549f183d22e40d1..c948f5a165b8b5f14d298601de99c90a4cc045e2 100644 (file)
--- a/src/apcups.c
+++ b/src/apcups.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "apcups");
- strcpy (vl.plugin_instance, "");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "apcups", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
strncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
plugin_dispatch_values (type, &vl);
diff --git a/src/apple_sensors.c b/src/apple_sensors.c
index 2726ad2efdb6fc550e05163814e4c2f9c2d49557..5e957b6f88a9e9b302634b6aa0f053118c6db020 100644 (file)
--- a/src/apple_sensors.c
+++ b/src/apple_sensors.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "apple_sensors");
- strcpy (vl.plugin_instance, "");
- strcpy (vl.type_instance, type_instance);
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "apple_sensors", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values (type, &vl);
}
if (strcmp (type, "temperature") == 0)
{
value_double = ((double) value_int) / 65536.0;
- strcpy (type, "temperature");
+ sstrncpy (type, "temperature", sizeof (type));
}
else if (strcmp (type, "temp") == 0)
{
value_double = ((double) value_int) / 10.0;
- strcpy (type, "temperature");
+ sstrncpy (type, "temperature", sizeof (type));
}
else if (strcmp (type, "fanspeed") == 0)
{
value_double = ((double) value_int) / 65536.0;
- strcpy (type, "fanspeed");
+ sstrncpy (type, "fanspeed", sizeof (type));
}
else if (strcmp (type, "voltage") == 0)
{
else if (strcmp (type, "adc") == 0)
{
value_double = ((double) value_int) / 10.0;
- strcpy (type, "fanspeed");
+ sstrncpy (type, "fanspeed", sizeof (type));
}
else
{
diff --git a/src/battery.c b/src/battery.c
index 345f606e8f3f834b5398fd15b3c91308607fb4a0..badd8e752f47717df72b63cb5360e441b0c203f8 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "battery");
- strcpy (vl.plugin_instance, plugin_instance);
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "battery", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
plugin_dispatch_values (type, &vl);
} /* void battery_submit */
diff --git a/src/cpu.c b/src/cpu.c
index c79c4b66bc4e01b994eb95222189592a413487d6..0daebcc02f9f90d460c537c4a50ca3f2f0bde6af 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "cpu");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "cpu", sizeof (vl.plugin));
snprintf (vl.plugin_instance, sizeof (vl.type_instance),
"%i", cpu_num);
vl.plugin_instance[DATA_MAX_NAME_LEN - 1] = '\0';
- strcpy (vl.type_instance, type_instance);
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values ("cpu", &vl);
}
diff --git a/src/cpufreq.c b/src/cpufreq.c
index 42248a98deebf9a8b4a5f6e5d5e7f76c72e0b2e9..74e542b49745c151020ac4d849ff86815bc49339 100644 (file)
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "cpufreq");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "cpufreq", sizeof (vl.plugin));
snprintf (vl.type_instance, sizeof (vl.type_instance),
"%i", cpu_num);
diff --git a/src/df.c b/src/df.c
index 0f357d8ded8671e7ced051c4b0b01c17760653cd..6bd92500834c1659c2066c11d124bea27dbab5d1 100644 (file)
--- a/src/df.c
+++ b/src/df.c
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "df");
- strcpy (vl.plugin_instance, "");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "df", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
strncpy (vl.type_instance, df_name, sizeof (vl.type_instance));
plugin_dispatch_values ("df", &vl);
diff --git a/src/disk.c b/src/disk.c
index e7372ab7a42dd8c0087450facb973d91e02665a8..536c51116ade61b606e3c10ac29cec7ef2dd948b 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "disk");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "disk", sizeof (vl.plugin));
strncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
diff --git a/src/dns.c b/src/dns.c
index e9996b996d74409b3a4fbd0a61635dd4ce63b8ca..69cb1922c3fd26ca8306f6c91fa1882ed4ccf364 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "dns");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "dns", sizeof (vl.plugin));
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values (type, &vl);
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "dns");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "dns", sizeof (vl.plugin));
plugin_dispatch_values ("dns_octets", &vl);
} /* void submit_counter */
diff --git a/src/email.c b/src/email.c
index 869b7c36aa620cff5f7ae2f2d806d79868084eea..b718cf5c9eb184633dc37da18897f6bd4c65b6d7 100644 (file)
--- a/src/email.c
+++ b/src/email.c
@@ -733,8 +733,8 @@ static void email_submit (const char *type, const char *type_instance, gauge_t v
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "email");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "email", sizeof (vl.plugin));
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values (type, &vl);
diff --git a/src/entropy.c b/src/entropy.c
index 5f9eb530caf33bf95e364199312f310d2e0fe8d8..69ce3142bc7f4e412ded5f0483be4c793f3cb7d6 100644 (file)
--- a/src/entropy.c
+++ b/src/entropy.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "entropy");
- strcpy (vl.plugin_instance, "");
- strcpy (vl.type_instance, "");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "entropy", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
+ sstrncpy (vl.type_instance, "", sizeof (vl.type_instance));
plugin_dispatch_values ("entropy", &vl);
}
diff --git a/src/hddtemp.c b/src/hddtemp.c
index 36ada53c4b2b673375e9a7982f3b62dd7dff383b..cb49577057f9e277c1777e9710dc351775483be9 100644 (file)
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "hddtemp");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "hddtemp", sizeof (vl.plugin));
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values ("temperature", &vl);
diff --git a/src/interface.c b/src/interface.c
index 33736b678905ed30a699ca7cf262e014feafa1cc..2add89d750004b163c85da9536ede49443dbb400 100644 (file)
--- a/src/interface.c
+++ b/src/interface.c
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "interface");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "interface", sizeof (vl.plugin));
strncpy (vl.type_instance, dev, sizeof (vl.type_instance));
plugin_dispatch_values (type, &vl);
diff --git a/src/iptables.c b/src/iptables.c
index 72b4481cc5148ff500d6ed01076c12378a6c3932..6522a5596ed61ea71b09d2e1104de50bfaf09127 100644 (file)
--- a/src/iptables.c
+++ b/src/iptables.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "iptables");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "iptables", sizeof (vl.plugin));
status = snprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
"%s-%s", chain->table, chain->chain);
diff --git a/src/ipvs.c b/src/ipvs.c
index 68a3d7f3bf9d46a9f47c17492a6acd926458cfbc..31e9741562ac46427a8ccc171f302b8d27934b92 100644 (file)
--- a/src/ipvs.c
+++ b/src/ipvs.c
vl.time = time (NULL);
vl.interval = interval_g;
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "ipvs");
- strcpy (vl.plugin_instance, pi);
- strcpy (vl.type_instance, (NULL != ti) ? ti : "total");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, pi, sizeof (vl.plugin_instance));
+ sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total", sizeof (vl.type_instance));
plugin_dispatch_values ("connections", &vl);
return;
vl.time = time (NULL);
vl.interval = interval_g;
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "ipvs");
- strcpy (vl.plugin_instance, pi);
- strcpy (vl.type_instance, (NULL != ti) ? ti : "total");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, pi, sizeof (vl.plugin_instance));
+ sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total", sizeof (vl.type_instance));
plugin_dispatch_values (t, &vl);
return;
diff --git a/src/irq.c b/src/irq.c
index 9eb1de426b83bea8b7243f0c2e9c993de87fdb1c..93c6076ba0429396131650a90766f2f075938142 100644 (file)
--- a/src/irq.c
+++ b/src/irq.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "irq");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "irq", sizeof (vl.plugin));
status = snprintf (vl.type_instance, sizeof (vl.type_instance),
"%u", irq);
diff --git a/src/load.c b/src/load.c
index 15215d3c6df1461aa4f4e3e8a21d35525a328e23..e0e0c0ed87942a04afdeb03fa0338bc08446e64e 100644 (file)
--- a/src/load.c
+++ b/src/load.c
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "load");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "load", sizeof (vl.plugin));
plugin_dispatch_values ("load", &vl);
}
diff --git a/src/mbmon.c b/src/mbmon.c
index 50d7363268840771f6d7ff30d85ae58e252bc7ec..22a26da5e613ef884d3b5c92331b574d85e1d5ff 100644 (file)
--- a/src/mbmon.c
+++ b/src/mbmon.c
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);
diff --git a/src/memcached.c b/src/memcached.c
index a1825780ee1624ab7f4583bdf70295faef48a766..c830598d273c89dca7631c38bc8614a2a81caa72 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
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));
if (type_inst != NULL)
{
strncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
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));
if (type_inst != NULL)
{
strncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
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));
if (type_inst != NULL)
{
strncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
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));
if (type_inst != NULL)
{
strncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
diff --git a/src/memory.c b/src/memory.c
index fe3a16ebc17745ebcafe893e855daf0df67ba6ee..583f71a2041b1eff7f34de985ae85d4d2537ce04 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "memory");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "memory", sizeof (vl.plugin));
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
diff --git a/src/multimeter.c b/src/multimeter.c
index 11ca42c1f6fd1dcda1c7dacb57754f7b33f8c8e7..c6b070a035691a2cbabd3c816231444448892ea5 100644 (file)
--- a/src/multimeter.c
+++ b/src/multimeter.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "multimeter");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "multimeter", sizeof (vl.plugin));
plugin_dispatch_values ("multimeter", &vl);
}
diff --git a/src/mysql.c b/src/mysql.c
index d4728531027be022e8ad9d6a57994a06711785d8..aa585d6554eb88ddedffb8f38f5286b386deeba6 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "mysql");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "mysql", sizeof (vl.plugin));
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values (type, &vl);
vl.values = values;
vl.values_len = 5;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "mysql");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "mysql", sizeof (vl.plugin));
plugin_dispatch_values ("mysql_qcache", &vl);
} /* void qcache_submit */
vl.values = values;
vl.values_len = 4;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "mysql");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "mysql", sizeof (vl.plugin));
plugin_dispatch_values ("mysql_threads", &vl);
} /* void threads_submit */
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "mysql");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "mysql", sizeof (vl.plugin));
plugin_dispatch_values ("mysql_octets", &vl);
} /* void traffic_submit */
diff --git a/src/netlink.c b/src/netlink.c
index 22afdc77f9a1701e8763207efe8bf1391c2c683e..e54365d0587b55447ff50fb76dffa8085db8ef76 100644 (file)
--- a/src/netlink.c
+++ b/src/netlink.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "netlink");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "netlink", sizeof (vl.plugin));
strncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
if (type_instance != NULL)
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "netlink");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "netlink", sizeof (vl.plugin));
strncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
if (type_instance != NULL)
diff --git a/src/network.c b/src/network.c
index ff806af3a10ac72eaa53a6a4edbd33a0f36b0f6e..022e46a1e0096488f333832d8f1051d7d7c9ae66 100644 (file)
--- a/src/network.c
+++ b/src/network.c
if (write_part_string (&buffer, &buffer_size, TYPE_HOST,
vl->host, strlen (vl->host)) != 0)
return (-1);
- strcpy (vl_def->host, vl->host);
+ sstrncpy (vl_def->host, vl->host, sizeof (vl_def->host));
}
if (vl_def->time != vl->time)
if (write_part_string (&buffer, &buffer_size, TYPE_PLUGIN,
vl->plugin, strlen (vl->plugin)) != 0)
return (-1);
- strcpy (vl_def->plugin, vl->plugin);
+ sstrncpy (vl_def->plugin, vl->plugin, sizeof (vl_def->plugin));
}
if (strcmp (vl_def->plugin_instance, vl->plugin_instance) != 0)
vl->plugin_instance,
strlen (vl->plugin_instance)) != 0)
return (-1);
- strcpy (vl_def->plugin_instance, vl->plugin_instance);
+ sstrncpy (vl_def->plugin_instance, vl->plugin_instance, sizeof (vl_def->plugin_instance));
}
if (strcmp (type_def, ds->type) != 0)
if (write_part_string (&buffer, &buffer_size, TYPE_TYPE,
ds->type, strlen (ds->type)) != 0)
return (-1);
- strcpy (type_def, ds->type);
+ sstrncpy (type_def, ds->type, sizeof (type_def));
}
if (strcmp (vl_def->type_instance, vl->type_instance) != 0)
vl->type_instance,
strlen (vl->type_instance)) != 0)
return (-1);
- strcpy (vl_def->type_instance, vl->type_instance);
+ sstrncpy (vl_def->type_instance, vl->type_instance, sizeof (vl_def->type_instance));
}
if (write_part_values (&buffer, &buffer_size, ds, vl) != 0)
diff --git a/src/nfs.c b/src/nfs.c
index 77c7f48f92e3aee3be927e4b34be9c1fa89b01d7..91e6788631acba20630a3da4434444cde9e5f4f1 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "nfs");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "nfs", sizeof (vl.plugin));
strncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
diff --git a/src/nginx.c b/src/nginx.c
index 0e3b843d2d7780c5d91a620f3d59a1744cdd53e8..a5201a023d6395925d3cfcf979140e5299be8fda 100644 (file)
--- a/src/nginx.c
+++ b/src/nginx.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "nginx");
- strcpy (vl.plugin_instance, "");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "nginx", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
if (inst != NULL)
{
diff --git a/src/ntpd.c b/src/ntpd.c
index 90fdfd7c587628fd8f035dd43ae9d28b47f87094..ff0a48dceeb6a42a4150937fed013c6b06279336 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "ntpd");
- strcpy (vl.plugin_instance, "");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "ntpd", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
strncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
plugin_dispatch_values (type, &vl);
diff --git a/src/nut.c b/src/nut.c
index f7f026a6299adac2a87d2dc1432789880273c1e2..695d93b5aa574a7f1c3469f8272e14983d29789c 100644 (file)
--- a/src/nut.c
+++ b/src/nut.c
? hostname_g
: ups->hostname,
sizeof (vl.host));
- strcpy (vl.plugin, "nut");
+ sstrncpy (vl.plugin, "nut", sizeof (vl.plugin));
strncpy (vl.plugin_instance, ups->upsname, sizeof (vl.plugin_instance));
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
diff --git a/src/perl.c b/src/perl.c
index 877bc00805cc0e5f78a09d2a03bc02ae0682e30d..22a13cee6cabe524a4b08185f1e68a9c2be93221 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
list.host[DATA_MAX_NAME_LEN - 1] = '\0';
}
else {
- strcpy (list.host, hostname_g);
+ sstrncpy (list.host, hostname_g, sizeof (list.host));
}
if (NULL != (tmp = hv_fetch (values, "plugin", 6, 0))) {
diff --git a/src/ping.c b/src/ping.c
index 2f7c064d1871363f3199a8deb581a2681e9ff51d..09de77ce97f8db083127a386f6ec41ea99c1d134 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "ping");
- strcpy (vl.plugin_instance, "");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "ping", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
strncpy (vl.type_instance, host, sizeof (vl.type_instance));
plugin_dispatch_values ("ping", &vl);
diff --git a/src/processes.c b/src/processes.c
index 22d369df279c73ddccaf4489d586eb7eddd84d08..6ad4681370aa7861e11cb7b956576010befd0faa 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "processes");
- strcpy (vl.plugin_instance, "");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "processes", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
strncpy (vl.type_instance, state, sizeof (vl.type_instance));
plugin_dispatch_values ("ps_state", &vl);
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "processes");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "processes", sizeof (vl.plugin));
strncpy (vl.plugin_instance, ps->name, sizeof (vl.plugin_instance));
vl.values[0].gauge = ps->vmem_rss;
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 3bb5a9e7ede71ed45b87f09fa3dd2424a305b850..adf6eeb18ce24c24ddc4bb2c10e2c112537b9f6e 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
if (isnan (d->min))
{
- strcpy (min, "U");
+ sstrncpy (min, "U", sizeof (min));
}
else
{
if (isnan (d->max))
{
- strcpy (max, "U");
+ sstrncpy (max, "U", sizeof (max));
}
else
{
diff --git a/src/serial.c b/src/serial.c
index 9cfe1dd471b6ee1e195781617512a4ee16dd5d05..4f08a346eb542fee24e84d3f4918fcc73552a4fb 100644 (file)
--- a/src/serial.c
+++ b/src/serial.c
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "serial");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "serial", sizeof (vl.plugin));
strncpy (vl.type_instance, type_instance,
sizeof (vl.type_instance));
diff --git a/src/snmp.c b/src/snmp.c
index 4311ff1670b5f92a6e2927d16420e2c1c5f8a011..6788ea9b8c26f31706f7b78a5c3df3336bb6f96d 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
@@ -909,7 +909,7 @@ static int csnmp_dispatch_table (host_definition_t *host, data_definition_t *dat
strncpy (vl.host, host->name, sizeof (vl.host));
vl.host[sizeof (vl.host) - 1] = '\0';
- strcpy (vl.plugin, "snmp");
+ sstrncpy (vl.plugin, "snmp", sizeof (vl.plugin));
vl.interval = host->interval;
vl.time = time (NULL);
@@ -1301,7 +1301,7 @@ static int csnmp_read_value (host_definition_t *host, data_definition_t *data)
strncpy (vl.host, host->name, sizeof (vl.host));
vl.host[sizeof (vl.host) - 1] = '\0';
- strcpy (vl.plugin, "snmp");
+ sstrncpy (vl.plugin, "snmp", sizeof (vl.plugin));
strncpy (vl.type_instance, data->instance.string, sizeof (vl.type_instance));
vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
diff --git a/src/swap.c b/src/swap.c
index e91ebefd916ae1439738661c336915ee5980a5ac..4d1f24de73ae40bf79a07621e6bfb945521669a3 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "swap");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "swap", sizeof (vl.plugin));
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values ("swap", &vl);
diff --git a/src/tape.c b/src/tape.c
index 465688ed5cf2a470df3430fed859c44f2b9f83e6..5b5cdb4641d9d176599e689c195d8d36d923b113 100644 (file)
--- a/src/tape.c
+++ b/src/tape.c
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "tape");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "tape", sizeof (vl.plugin));
strncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
diff --git a/src/tcpconns.c b/src/tcpconns.c
index fdf7ec1bf1ed867c5f08080c89e0e8a235557330..5a8f461971a8909391a99d36bb89eacf57d71252 100644 (file)
--- a/src/tcpconns.c
+++ b/src/tcpconns.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "tcpconns");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "tcpconns", sizeof (vl.plugin));
if (((port_collect_listening != 0) && (pe->flags & PORT_IS_LISTENING))
|| (pe->flags & PORT_COLLECT_LOCAL))
diff --git a/src/users.c b/src/users.c
index afe26e1e27fc27a3d155b135b56d3571290bcd46..5e6a0b5aa8e16eb18023a5786e096169b57dd824 100644 (file)
--- a/src/users.c
+++ b/src/users.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "users");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "users", sizeof (vl.plugin));
plugin_dispatch_values ("users", &vl);
} /* void users_submit */
diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c
index 98b5043f33d1a94156fa509404a840af76dc69bb..e5f74950f192643d98e84cc7ee494cdb1b122961 100644 (file)
--- a/src/utils_cmd_putval.c
+++ b/src/utils_cmd_putval.c
return (-1);
}
- strcpy (vl.host, hostname);
- strcpy (vl.plugin, plugin);
+ sstrncpy (vl.host, hostname, sizeof (vl.host));
+ sstrncpy (vl.plugin, plugin, sizeof (vl.plugin));
if (plugin_instance != NULL)
- strcpy (vl.plugin_instance, plugin_instance);
+ 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) {
diff --git a/src/utils_dns.c b/src/utils_dns.c
index 25ef18998bb9f62ad928130e49b531f71501f15f..3f5d4fb2c3771acab11e394fa52991ee68f4c5f5 100644 (file)
--- a/src/utils_dns.c
+++ b/src/utils_dns.c
if (0 != x)
return 0;
if ('\0' == qh.qname[0])
- strcpy(qh.qname, ".");
+ strncpy (qh.qname, ".", sizeof (qh.qname));
while ((t = strchr(qh.qname, '\n')))
*t = ' ';
while ((t = strchr(qh.qname, '\r')))
diff --git a/src/vserver.c b/src/vserver.c
index 7b83c6174a830a0da933f4bd0c90f1c1180b67a3..54843449b09acff812f3f2edc9f9c6dd8a9ad99e 100644 (file)
--- a/src/vserver.c
+++ b/src/vserver.c
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "vserver");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
strncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "vserver");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
strncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
plugin_dispatch_values ("load", &vl);
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "vserver");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
strncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
diff --git a/src/wireless.c b/src/wireless.c
index fdea9d3bfdce76af90cc2733636cbe2ce6b2ea43..0edaf458688bcddd3dcce19c42652be93ece2e52 100644 (file)
--- a/src/wireless.c
+++ b/src/wireless.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "wireless");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "wireless", sizeof (vl.plugin));
strncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
diff --git a/src/xmms.c b/src/xmms.c
index 1e646d21165722b289f6721dd672837e03b5b40c..7f3edf0a27fd762d3b18f93ff4c8f2a0a8a05a16 100644 (file)
--- a/src/xmms.c
+++ b/src/xmms.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "xmms");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "xmms", sizeof (vl.plugin));
plugin_dispatch_values (type, &vl);
} /* void cxmms_submit */