author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 6 Jul 2008 14:17:27 +0000 (16:17 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 6 Jul 2008 14:17:27 +0000 (16:17 +0200) |
Conflicts:
src/apache.c
src/apcups.c
src/apple_sensors.c
src/battery.c
src/cpu.c
src/cpufreq.c
src/df.c
src/disk.c
src/dns.c
src/email.c
src/entropy.c
src/hddtemp.c
src/interface.c
src/ipvs.c
src/irq.c
src/load.c
src/mbmon.c
src/memcached.c
src/memory.c
src/multimeter.c
src/mysql.c
src/netlink.c
src/network.c
src/nfs.c
src/nginx.c
src/ntpd.c
src/nut.c
src/ping.c
src/processes.c
src/rrdtool.c
src/serial.c
src/snmp.c
src/swap.c
src/tape.c
src/tcpconns.c
src/users.c
src/utils_cmd_putval.c
src/vserver.c
src/wireless.c
src/xmms.c
src/apache.c
src/apcups.c
src/apple_sensors.c
src/battery.c
src/cpu.c
src/cpufreq.c
src/df.c
src/disk.c
src/dns.c
src/email.c
src/entropy.c
src/hddtemp.c
src/interface.c
src/ipvs.c
src/irq.c
src/load.c
src/mbmon.c
src/memcached.c
src/memory.c
src/multimeter.c
src/mysql.c
src/netlink.c
src/network.c
src/nfs.c
src/nginx.c
src/ntpd.c
src/nut.c
src/ping.c
src/processes.c
src/rrdtool.c
src/serial.c
src/snmp.c
src/swap.c
src/tape.c
src/tcpconns.c
src/users.c
src/utils_cmd_putval.c
src/vserver.c
src/wireless.c
src/xmms.c
51 files changed:
diff --cc src/apache.c
index 7667f247604b330ace7f4426aef9d659a139c05c,a2f41f4bdab52f017827073d5373ae64c08ea5ca..c6bf8addfed4d6918c7345e5839b3a92105a4c3f
--- 1/src/apache.c
--- 2/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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
if (type_instance != NULL)
- {
- strncpy (vl.type_instance, type_instance,
+ sstrncpy (vl.type_instance, type_instance,
sizeof (vl.type_instance));
- vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
- }
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void submit_counter */
static void submit_gauge (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, "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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
if (type_instance != NULL)
- {
- strncpy (vl.type_instance, type_instance,
+ sstrncpy (vl.type_instance, type_instance,
sizeof (vl.type_instance));
- vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
- }
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void submit_counter */
static void submit_scoreboard (char *buf)
diff --cc src/apcups.c
index fb481092c18108dbed8d3be09fb41e6655457e26,c948f5a165b8b5f14d298601de99c90a4cc045e2..227c703c558fef41b8b338079c27321b281f5f48
--- 1/src/apcups.c
--- 2/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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
}
static void apc_submit (struct apc_detail_s *apcups_detail)
diff --cc src/apple_sensors.c
index ee0bf8c09da13b2fb84fd487c0f9d906bccba6d5,5e957b6f88a9e9b302634b6aa0f053118c6db020..629633589bc0b086b3918d167090512b2bba33d2
--- 1/src/apple_sensors.c
--- 2/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, "");
+ 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, type, sizeof (vl.type))
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
}
static int as_read (void)
diff --cc src/ascent.c
Simple merge
diff --cc src/battery.c
index 74b3344a1e28e494861d45d3732d335c1b82fcf4,badd8e752f47717df72b63cb5360e441b0c203f8..9f1bee654e014812f254070a458f2be5a60508d3
--- 1/src/battery.c
--- 2/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");
+ 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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void battery_submit */
#if HAVE_IOKIT_PS_IOPOWERSOURCES_H || HAVE_IOKIT_IOKITLIB_H
diff --cc src/collectd.conf.in
Simple merge
diff --cc src/collectd.h
Simple merge
diff --cc src/common.c
Simple merge
diff --cc src/cpu.c
index 7773dc419d7febec33b0438d9599ab79c53cc8b7,0fadc06458d2fbb5ace382a731bb6bcf19283bb3..e9ab78320d4523848274f726eb42e2bb87eb030f
+++ 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),
+ ssnprintf (vl.plugin_instance, sizeof (vl.type_instance),
"%i", cpu_num);
- strcpy (vl.type, "cpu");
- vl.plugin_instance[DATA_MAX_NAME_LEN - 1] = '\0';
++ sstrncpy (vl.type, "cpu", sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values ("cpu", &vl);
+ plugin_dispatch_values (&vl);
}
static int cpu_read (void)
diff --cc src/cpufreq.c
index f4424e6556af254d556a9b902be012fc8ff5ad83,74e542b49745c151020ac4d849ff86815bc49339..3738b54c2f450eb8f3f4e52994f9180b369d3850
--- 1/src/cpufreq.c
--- 2/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");
- strcpy (vl.type, "cpufreq");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "cpufreq", sizeof (vl.plugin));
- snprintf (vl.type_instance, sizeof (vl.type_instance),
++ sstrncpy (vl.type, "cpufreq", sizeof (vl.type));
+ ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%i", cpu_num);
- plugin_dispatch_values ("cpufreq", &vl);
+ plugin_dispatch_values (&vl);
}
static int cpufreq_read (void)
diff --cc src/df.c
index 284472b1c21ebd5ade66bfcc59456b04db3bfd6d,6bd92500834c1659c2066c11d124bea27dbab5d1..26d23826fccf32c81420f417192956737f64bdc8
+++ 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, "");
- strcpy (vl.type, "df");
+ 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));
++ sstrncpy (vl.type, "df", sizeof (vl.host));
+ sstrncpy (vl.type_instance, df_name, sizeof (vl.type_instance));
- plugin_dispatch_values ("df", &vl);
+ plugin_dispatch_values (&vl);
} /* void df_submit */
static int df_read (void)
diff --cc src/disk.c
index a6f850a15f799351bba0703caa729a75b37b2b65,20afd30b602fca4b10e9ccfe1b8a9ecfbf22a15c..29aa979018b42bc9621d5b011a73daf0ae12722c
--- 1/src/disk.c
--- 2/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,
+ sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
+ sstrncpy (vl.type, type, sizeof (vl.type));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void disk_submit */
#if HAVE_IOKIT_IOKITLIB_H
diff --cc src/dns.c
index c315eab960578f75df75476465726b387e9adf47,69cb1922c3fd26ca8306f6c91fa1882ed4ccf364..c04169fec8a4809cb9e7b5516b5011e8d49a6e3a
+++ 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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void submit_counter */
static void submit_octets (counter_t queries, counter_t responses)
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "dns");
- strcpy (vl.type, "dns_octets");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "dns", sizeof (vl.plugin));
++ sstrncpy (vl.type, "dns_octets", sizeof (vl.type));
- plugin_dispatch_values ("dns_octets", &vl);
+ plugin_dispatch_values (&vl);
} /* void submit_counter */
static int dns_read (void)
diff --cc src/email.c
index fbdc785f9374ecdc0826f056a7176f3d1b3a49c1,0882ad46299b5d118494c0407c7f4a9a0f17a9cb..e208f13049f168cbc08775366d5e01f7523c1982
--- 1/src/email.c
--- 2/src/email.c
+++ b/src/email.c
}
addr.sun_family = AF_UNIX;
--
- strncpy (addr.sun_path, path, (size_t)(UNIX_PATH_MAX - 1));
- addr.sun_path[UNIX_PATH_MAX - 1] = '\0';
+ sstrncpy (addr.sun_path, path, (size_t)(UNIX_PATH_MAX - 1));
- unlink (addr.sun_path);
errno = 0;
if (-1 == bind (connector_socket, (struct sockaddr *)&addr,
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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void email_submit */
/* Copy list l1 to list l2. l2 may partly exist already, but it is assumed
diff --cc src/entropy.c
index 85d41cfc6d54ef74b9e5c913f74592f8b937b13a,69ce3142bc7f4e412ded5f0483be4c793f3cb7d6..2e20a67c08661dbdebd4e66e276184e17d97983b
--- 1/src/entropy.c
--- 2/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, "entropy");
- 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));
++ sstrncpy (vl.type, "entropy", sizeof (vl.type));
- plugin_dispatch_values ("entropy", &vl);
+ plugin_dispatch_values (&vl);
}
static int entropy_read (void)
diff --cc src/hddtemp.c
index a9c094186516b699c7771249c29a026bbf2d2891,cb49577057f9e277c1777e9710dc351775483be9..9f4a7254feede2d27d057bdf5750bb1ee3f73ba2
--- 1/src/hddtemp.c
--- 2/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");
- strcpy (vl.type, "temperature");
+ 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));
++ sstrncpy (vl.type, "temperature", sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values ("temperature", &vl);
+ plugin_dispatch_values (&vl);
}
static int hddtemp_read (void)
diff --cc src/interface.c
index ff4a0aa1f1af35afda0e82e156348eb7d44338ab,2add89d750004b163c85da9536ede49443dbb400..806a336dfde09c814c9ab9f204e5770758251893
--- 1/src/interface.c
--- 2/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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
+ sstrncpy (vl.type_instance, dev, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void if_submit */
static int interface_read (void)
diff --cc src/iptables.c
index dc69f6be49c4e85c1d8522b0b00ec7201733778c,ea8c65e9008916c6004d4ce0b9e41f24f78cba64..4d15c6e0896ac62e15b3082fb6c622403c4add2d
--- 1/src/iptables.c
--- 2/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),
+ status = ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
"%s-%s", chain->table, chain->chain);
if ((status < 1) || ((unsigned int)status >= sizeof (vl.plugin_instance)))
return (0);
else
{
if (chain->rule_type == RTYPE_NUM)
- snprintf (vl.type_instance, sizeof (vl.type_instance),
+ ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%i", chain->rule.num);
else
- strncpy (vl.type_instance, (char *) match->data,
+ sstrncpy (vl.type_instance, (char *) match->data,
sizeof (vl.type_instance));
}
- vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
- strcpy (vl.type, "ipt_bytes");
++ sstrncpy (vl.type, "ipt_bytes", sizeof (vl.type));
values[0].counter = (counter_t) entry->counters.bcnt;
- plugin_dispatch_values ("ipt_bytes", &vl);
+ plugin_dispatch_values (&vl);
- strcpy (vl.type, "ipt_packets");
++ sstrncpy (vl.type, "ipt_packets", sizeof (vl.type));
values[0].counter = (counter_t) entry->counters.pcnt;
- plugin_dispatch_values ("ipt_packets", &vl);
+ plugin_dispatch_values (&vl);
return (0);
} /* void submit_match */
diff --cc src/ipvs.c
index a64e7b7a99d56a4896c444235a10cf14090fbdf3,31e9741562ac46427a8ccc171f302b8d27934b92..10c4d1517415cb7bf0b57a216f5cd4f3a8c22513
--- 1/src/ipvs.c
--- 2/src/ipvs.c
+++ b/src/ipvs.c
vl.time = time (NULL);
vl.interval = interval_g;
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "ipvs");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, pi, sizeof (vl.plugin_instance));
- strcpy (vl.type, "connections");
- sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total", sizeof (vl.type_instance));
++ sstrncpy (vl.type, "connections", sizeof (vl.type));
+ sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total",
+ sizeof (vl.type_instance));
- plugin_dispatch_values ("connections", &vl);
+ plugin_dispatch_values (&vl);
return;
} /* cipvs_submit_connections */
vl.time = time (NULL);
vl.interval = interval_g;
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "ipvs");
+ 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));
+ sstrncpy (vl.type, t, sizeof (vl.type));
+ sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total",
+ sizeof (vl.type_instance));
- plugin_dispatch_values (t, &vl);
+ plugin_dispatch_values (&vl);
return;
} /* cipvs_submit_if */
diff --cc src/irq.c
index 792ac346fa83c3e0ac9df24c1844c2e0325e0d79,93c6076ba0429396131650a90766f2f075938142..9b7e61877d8c62bafc009e91e1f792c43024e63e
+++ b/src/irq.c
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "irq");
- strcpy (vl.type, "irq");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "irq", sizeof (vl.plugin));
++ sstrncpy (vl.type, "irq", sizeof (vl.type));
- status = snprintf (vl.type_instance, sizeof (vl.type_instance),
+ status = ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%u", irq);
if ((status < 1) || ((unsigned int)status >= sizeof (vl.type_instance)))
return;
diff --cc src/libvirt.c
Simple merge
diff --cc src/load.c
index 7d11b986fe5ba0e4a390a4afa7bde50f62d8d6dc,e0e0c0ed87942a04afdeb03fa0338bc08446e64e..72c7756a34b27d325b82fcc084e3afdb77f02dc8
--- 1/src/load.c
--- 2/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");
- strcpy (vl.type, "load");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "load", sizeof (vl.plugin));
++ sstrncpy (vl.type, "load", sizeof (vl.type));
- plugin_dispatch_values ("load", &vl);
+ plugin_dispatch_values (&vl);
}
static int load_read (void)
diff --cc src/mbmon.c
index 923118f62ceb486f88dcbbc0c363639e6360f681,22a26da5e613ef884d3b5c92331b574d85e1d5ff..344caddffd91f286b94b96721d065b4c2751f652
--- 1/src/mbmon.c
--- 2/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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void mbmon_submit */
/* Trim trailing whitespace from a string. */
diff --cc src/memcached.c
index ca93102f2a2865a9ab2b1bbb3919f7b1b064d272,c830598d273c89dca7631c38bc8614a2a81caa72..ddea2ea2f0926874775c1d20cc1ac5bce6a2c74d
--- 1/src/memcached.c
--- 2/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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
if (type_inst != NULL)
- {
- strncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
- vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
- }
+ sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void memcached_submit_cmd */
/* }}} */
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)
- {
- strncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
- vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
- }
+ sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void memcached_submit_cmd */
/* }}} */
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)
- {
- strncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
- vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
- }
+ sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
}
/* }}} */
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)
- {
- strncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
- vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
- }
+ sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
}
/* }}} */
diff --cc src/memory.c
index b56fc5a3f784cae4fd02dcb19ab283f895b30fc4,583f71a2041b1eff7f34de985ae85d4d2537ce04..c1564c86caf1840465ef5cecc14487d2e63a5eee
--- 1/src/memory.c
--- 2/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");
- strcpy (vl.type, "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';
++ sstrncpy (vl.type, "memory", sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values ("memory", &vl);
+ plugin_dispatch_values (&vl);
}
static int memory_read (void)
diff --cc src/multimeter.c
index e09d9f989f5092db830b1998258b3a4d703fa516,c6b070a035691a2cbabd3c816231444448892ea5..994747f94f4167c352febc69c8ca4eb884c28650
--- 1/src/multimeter.c
--- 2/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");
- strcpy (vl.type, "multimeter");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "multimeter", sizeof (vl.plugin));
++ sstrncpy (vl.type, "multimeter", sizeof (vl.type));
- plugin_dispatch_values ("multimeter", &vl);
+ plugin_dispatch_values (&vl);
}
static int multimeter_read (void)
diff --cc src/mysql.c
index 444acaa26aef33ed1d858e78564f52adec599f05,aa585d6554eb88ddedffb8f38f5286b386deeba6..312a819e4980190a13bbabd957b30ca6efcea599
--- 1/src/mysql.c
--- 2/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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void counter_submit */
static void qcache_submit (counter_t hits, counter_t inserts,
vl.values = values;
vl.values_len = 5;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "mysql");
- strcpy (vl.type, "mysql_qcache");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "mysql", sizeof (vl.plugin));
++ sstrncpy (vl.type, "mysql_qcache", sizeof (vl.type));
- plugin_dispatch_values ("mysql_qcache", &vl);
+ plugin_dispatch_values (&vl);
} /* void qcache_submit */
static void threads_submit (gauge_t running, gauge_t connected, gauge_t cached,
vl.values = values;
vl.values_len = 4;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "mysql");
- strcpy (vl.type, "mysql_threads");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "mysql", sizeof (vl.plugin));
++ sstrncpy (vl.type, "mysql_threads", sizeof (vl.type));
- plugin_dispatch_values ("mysql_threads", &vl);
+ plugin_dispatch_values (&vl);
} /* void threads_submit */
static void traffic_submit (counter_t rx, counter_t tx)
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "mysql");
- strcpy (vl.type, "mysql_octets");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "mysql", sizeof (vl.plugin));
++ sstrncpy (vl.type, "mysql_octets", sizeof (vl.type));
- plugin_dispatch_values ("mysql_octets", &vl);
+ plugin_dispatch_values (&vl);
} /* void traffic_submit */
static int mysql_read (void)
diff --cc src/netlink.c
index d621da5bbb15b40d3d2d6efcb1982f8efcfa09f0,e54365d0587b55447ff50fb76dffa8085db8ef76..c2e4c9b46bfa2d23fe92dcf04c4434794d5c6310
--- 1/src/netlink.c
--- 2/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));
+ sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
+ sstrncpy (vl.type, type, sizeof (vl.type));
if (type_instance != NULL)
- strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void submit_one */
static void submit_two (const char *dev, const char *type,
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));
+ sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
+ sstrncpy (vl.type, type, sizeof (vl.type));
if (type_instance != NULL)
- strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void submit_two */
static int link_filter (const struct sockaddr_nl *sa,
diff --cc src/network.c
index b6778fa0797444901b71364c4f8a559552349f3c,0f558ca921dcbfbb66a523ba140de1c6576e9f6f..39069aa751a551eef139b92e9ecd467bb8e5b27a
--- 1/src/network.c
--- 2/src/network.c
+++ b/src/network.c
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 (strcmp (type_def, vl->type) != 0)
{
if (write_part_string (&buffer, &buffer_size, TYPE_TYPE,
- ds->type, strlen (ds->type)) != 0)
+ vl->type, strlen (vl->type)) != 0)
return (-1);
- strcpy (type_def, vl->type);
- sstrncpy (type_def, ds->type, sizeof (type_def));
++ sstrncpy (type_def, vl->type, sizeof (type_def));
}
if (strcmp (vl_def->type_instance, vl->type_instance) != 0)
diff --cc src/nfs.c
index 34f01f43ecd2d0622cae93397e5ecdaa55acb0e6,91e6788631acba20630a3da4434444cde9e5f4f1..f2db895a00d484bf647e1c2a9a7688dd106ca31e
+++ 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,
+ sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
- strcpy (vl.type, "nfs_procedure");
++ sstrncpy (vl.type, "nfs_procedure", sizeof (vl.type));
for (i = 0; i < len; i++)
{
diff --cc src/nginx.c
index 4de59f3752b8827f28bf8885ec2f3c9073dd6c5d,283e8f6f3fa85ae2568aab63c45a170ed8ba35ca..91bcf75404927bfcd708e16faf71b5b7606fe304
--- 1/src/nginx.c
--- 2/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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
if (inst != NULL)
- {
- strncpy (vl.type_instance, inst, sizeof (vl.type_instance));
- vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
- }
+ sstrncpy (vl.type_instance, inst, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void submit */
static int nginx_read (void)
diff --cc src/ntpd.c
index 9475ac910e1b1867d145e7623bfe2dc56d3c25c2,69b949b1edd682d7bb0a93dc3f20ae9a01ff09ed..22bbc5d1810d9ddbd3b9e10fb30602034e965a90
--- 1/src/ntpd.c
--- 2/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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
}
/* returns `tv0 - tv1' in milliseconds or 0 if `tv1 > tv0' */
diff --cc src/nut.c
index 75504d408ef7e2f8bc4bce09dc128eb18fa246b8,695d93b5aa574a7f1c3469f8272e14983d29789c..8796d5873377cb6fbb61c51a65f011616f235c76
+++ 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));
+ sstrncpy (vl.plugin_instance, ups->upsname, sizeof (vl.plugin_instance));
+ sstrncpy (vl.type, type, sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- vl.host[sizeof (vl.host) - 1] = '\0';
- vl.plugin_instance[sizeof (vl.plugin_instance) - 1] = '\0';
- vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
-
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void nut_submit */
static int nut_read_one (nut_ups_t *ups)
diff --cc src/perl.c
index 3a56da624c1c12489fab32cb757220cb616f6a7a,597368f1ae71884d661dbf0cd4b1713b1766a757..541826fb6eb04a2746904f2bcd441f0ec42a6e75
--- 1/src/perl.c
--- 2/src/perl.c
+++ b/src/perl.c
}
if (NULL != (tmp = hv_fetch (values, "host", 4, 0))) {
- strncpy (list.host, SvPV_nolen (*tmp), DATA_MAX_NAME_LEN);
- list.host[DATA_MAX_NAME_LEN - 1] = '\0';
+ sstrncpy (list.host, SvPV_nolen (*tmp), sizeof (list.host));
}
else {
- strcpy (list.host, hostname_g);
+ sstrncpy (list.host, hostname_g, sizeof (list.host));
}
- if (NULL != (tmp = hv_fetch (values, "plugin", 6, 0))) {
- strncpy (list.plugin, SvPV_nolen (*tmp), DATA_MAX_NAME_LEN);
- list.plugin[DATA_MAX_NAME_LEN - 1] = '\0';
- }
+ if (NULL != (tmp = hv_fetch (values, "plugin", 6, 0)))
+ sstrncpy (list.plugin, SvPV_nolen (*tmp), sizeof (list.plugin));
- if (NULL != (tmp = hv_fetch (values, "plugin_instance", 15, 0))) {
- strncpy (list.plugin_instance, SvPV_nolen (*tmp), DATA_MAX_NAME_LEN);
- list.plugin_instance[DATA_MAX_NAME_LEN - 1] = '\0';
- }
+ if (NULL != (tmp = hv_fetch (values, "plugin_instance", 15, 0)))
+ sstrncpy (list.plugin_instance, SvPV_nolen (*tmp),
+ sizeof (list.plugin_instance));
- if (NULL != (tmp = hv_fetch (values, "type_instance", 13, 0))) {
- strncpy (list.type_instance, SvPV_nolen (*tmp), DATA_MAX_NAME_LEN);
- list.type_instance[DATA_MAX_NAME_LEN - 1] = '\0';
- }
+ if (NULL != (tmp = hv_fetch (values, "type_instance", 13, 0)))
+ sstrncpy (list.type_instance, SvPV_nolen (*tmp),
+ sizeof (list.type_instance));
- ret = plugin_dispatch_values (name, &list);
+ ret = plugin_dispatch_values (&list);
sfree (val);
return ret;
diff --cc src/ping.c
index 20388c370d4801f52a33e1b0c823a6bdea04ac11,09de77ce97f8db083127a386f6ec41ea99c1d134..ac5b0f85907040ab0b7fbc242f6dad85d81ce79c
--- 1/src/ping.c
--- 2/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, "");
- strcpy (vl.type, "ping");
+ 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));
+ sstrncpy (vl.type_instance, host, sizeof (vl.type_instance));
++ sstrncpy (vl.type, "ping", sizeof (vl.type));
- plugin_dispatch_values ("ping", &vl);
+ plugin_dispatch_values (&vl);
}
static int ping_read (void)
diff --cc src/plugin.c
Simple merge
diff --cc src/powerdns.c
Simple merge
diff --cc src/processes.c
index c0d667d38ab14a15369a6b7e2469f81e72e164ba,6ad4681370aa7861e11cb7b956576010befd0faa..7531a6ae9cc1ac8d06c01ad7d1b7bc8ea7c936d6
--- 1/src/processes.c
--- 2/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, "");
- strcpy (vl.type, "ps_state");
+ 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));
++ sstrncpy (vl.type, "ps_state", sizeof (vl.type));
+ sstrncpy (vl.type_instance, state, sizeof (vl.type_instance));
- plugin_dispatch_values ("ps_state", &vl);
+ plugin_dispatch_values (&vl);
}
+/* submit info about specific process (e.g.: memory taken, cpu usage, etc..) */
static void ps_submit_proc_list (procstat_t *ps)
{
value_t values[2];
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));
+ sstrncpy (vl.plugin_instance, ps->name, sizeof (vl.plugin_instance));
- strcpy (vl.type, "ps_rss");
++ sstrncpy (vl.type, "ps_rss", sizeof (vl.type));
vl.values[0].gauge = ps->vmem_rss;
vl.values_len = 1;
- plugin_dispatch_values ("ps_rss", &vl);
+ plugin_dispatch_values (&vl);
- strcpy (vl.type, "ps_cputime");
++ sstrncpy (vl.type, "ps_cputime", sizeof (vl.type));
vl.values[0].counter = ps->cpu_user_counter;
vl.values[1].counter = ps->cpu_system_counter;
vl.values_len = 2;
- plugin_dispatch_values ("ps_cputime", &vl);
+ plugin_dispatch_values (&vl);
- strcpy (vl.type, "ps_count");
++ sstrncpy (vl.type, "ps_count", sizeof (vl.type));
vl.values[0].gauge = ps->num_proc;
vl.values[1].gauge = ps->num_lwp;
vl.values_len = 2;
- plugin_dispatch_values ("ps_count", &vl);
+ plugin_dispatch_values (&vl);
- strcpy (vl.type, "ps_pagefaults");
++ sstrncpy (vl.type, "ps_pagefaults", sizeof (vl.type));
vl.values[0].counter = ps->vmem_minflt_counter;
vl.values[1].counter = ps->vmem_majflt_counter;
vl.values_len = 2;
diff --cc src/rrdtool.c
index fd499fd9364bb9b9aaa00e2e89c989c54ea691f7,3b2c54fc9265bb49c05618164af4dc7d8f8ce121..7cf243671254cf261b77fe3e79d21885f321384e
--- 1/src/rrdtool.c
--- 2/src/rrdtool.c
+++ b/src/rrdtool.c
}
if (isnan (d->min))
- strcpy (min, "U");
+ {
+ sstrncpy (min, "U", sizeof (min));
+ }
else
- {
- snprintf (min, sizeof (min), "%lf", d->min);
- min[sizeof (min) - 1] = '\0';
- }
+ ssnprintf (min, sizeof (min), "%lf", d->min);
if (isnan (d->max))
- strcpy (max, "U");
+ {
+ sstrncpy (max, "U", sizeof (max));
+ }
else
- {
- snprintf (max, sizeof (max), "%lf", d->max);
- max[sizeof (max) - 1] = '\0';
- }
+ ssnprintf (max, sizeof (max), "%lf", d->max);
- status = snprintf (buffer, sizeof (buffer),
+ status = ssnprintf (buffer, sizeof (buffer),
"DS:%s:%s:%i:%s:%s",
d->name, type,
(heartbeat > 0) ? heartbeat : (2 * vl->interval),
diff --cc src/serial.c
index 1c5d5a5594389a140d3de387e5d4e83237f5b5d2,4f08a346eb542fee24e84d3f4918fcc73552a4fb..1c874e52177e919d59056126015da12edf760109
--- 1/src/serial.c
--- 2/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");
- strcpy (vl.type, "serial_octets");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "serial", sizeof (vl.plugin));
- strncpy (vl.type_instance, type_instance,
++ sstrncpy (vl.type, "serial_octets", sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance,
sizeof (vl.type_instance));
- plugin_dispatch_values ("serial_octets", &vl);
+ plugin_dispatch_values (&vl);
}
static int serial_read (void)
diff --cc src/snmp.c
index 75fa880e76911996fdb854ede9595392a326c9ff,6788ea9b8c26f31706f7b78a5c3df3336bb6f96d..d19493df9a53d5e4aefee9190cdc36cc6396afb3
--- 1/src/snmp.c
--- 2/src/snmp.c
+++ b/src/snmp.c
return (-1);
}
- strncpy (vl.host, host->name, sizeof (vl.host));
- vl.host[sizeof (vl.host) - 1] = '\0';
+ sstrncpy (vl.host, host->name, sizeof (vl.host));
- strcpy (vl.plugin, "snmp");
+ sstrncpy (vl.plugin, "snmp", sizeof (vl.plugin));
vl.interval = host->interval;
vl.time = time (NULL);
vl.values[i].gauge = NAN;
}
- strncpy (vl.host, host->name, sizeof (vl.host));
- vl.host[sizeof (vl.host) - 1] = '\0';
+ sstrncpy (vl.host, host->name, sizeof (vl.host));
- 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';
+ sstrncpy (vl.type, data->type, sizeof (vl.type));
+ sstrncpy (vl.type_instance, data->instance.string, sizeof (vl.type_instance));
vl.interval = host->interval;
diff --cc src/swap.c
index 4f0a0ba945459c9dab443412d955e60158ebfde8,4d1f24de73ae40bf79a07621e6bfb945521669a3..f9debc1b595a4e405bc3b11fad25716b2db2245c
--- 1/src/swap.c
--- 2/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");
- strcpy (vl.type, "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));
++ sstrncpy (vl.type, "swap", sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values ("swap", &vl);
+ plugin_dispatch_values (&vl);
} /* void swap_submit */
static int swap_read (void)
diff --cc src/tape.c
index 67750efc43868eb9134447447dbac7a4a44109e5,5b5cdb4641d9d176599e689c195d8d36d923b113..caca537b0038be024f2771d979f3eeeb289ce53d
--- 1/src/tape.c
--- 2/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,
+ sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
+ sstrncpy (vl.type, type, sizeof (vl.type));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void tape_submit */
static int tape_read (void)
diff --cc src/tcpconns.c
index 4f46e78abfd7a8cfab390b497957b010a021c4f6,5a8f461971a8909391a99d36bb89eacf57d71252..655c53e5689ff35647216d50b2a4b01e4bbb1cf2
--- 1/src/tcpconns.c
--- 2/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");
- strcpy (vl.type, "tcp_connections");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "tcpconns", sizeof (vl.plugin));
++ sstrncpy (vl.type, "tcp_connections", sizeof (vl.type));
if (((port_collect_listening != 0) && (pe->flags & PORT_IS_LISTENING))
|| (pe->flags & PORT_COLLECT_LOCAL))
diff --cc src/users.c
index 5b12e98cc9a5d9bf0efb797818fd69855857dfef,d0bd63cdb540ef2bc8d5e145e386f2590e604ef7..1231075a324803bd3fa866396c62563763496e67
--- 1/src/users.c
--- 2/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");
- strcpy (vl.type, "users");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "users", sizeof (vl.plugin));
++ sstrncpy (vl.type, "users", sizeof (vl.plugin));
- plugin_dispatch_values ("users", &vl);
+ plugin_dispatch_values (&vl);
} /* void users_submit */
static int users_read (void)
diff --cc src/utils_cmd_putval.c
index 8fbc8de3469325005c4cf6d59dac0eb8d863d2e2,16a09b1b71093c7eb5752e4c28772fc34800a667..9cbba126f48496c5750d623dc6cd5fe8fd0cdccf
+++ 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));
++ 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) {
diff --cc src/utils_dns.c
index b72cd5ca09c25283d5d54289b4e720dbc35f98fb,9b001517c80945f1d5e5e4d643c867f31a07ab54..f2ab3377ed43bf60dc40584e7dfbe3773cfdca9a
--- 1/src/utils_dns.c
--- 2/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));
++ sstrncpy (qh.qname, ".", sizeof (qh.qname));
while ((t = strchr(qh.qname, '\n')))
*t = ' ';
while ((t = strchr(qh.qname, '\r')))
diff --cc src/vmem.c
index 1e826a16b8a701bd5367dd3f1fc5e7a9de76bdc8,5341e1594798b9eb24b0826f489e87054ad80a78..25f7c70cd3c15b581f0f22f3252e921c82373c33
--- 1/src/vmem.c
--- 2/src/vmem.c
+++ b/src/vmem.c
vl.values_len = values_len;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "vmem");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "vmem", sizeof (vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
+ sstrncpy (vl.type, type, sizeof (vl.type));
if (type_instance != NULL)
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
diff --cc src/vserver.c
index 4cc8251674afda0665ec270906cb9343e8469637,54843449b09acff812f3f2edc9f9c6dd8a9ad99e..413674b0338b3f8844c8b2ac39ce80cf67961062
--- 1/src/vserver.c
--- 2/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));
+ sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
- strcpy (vl.type, "if_octets");
++ sstrncpy (vl.type, "if_octets", sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values ("if_octets", &vl);
+ plugin_dispatch_values (&vl);
} /* void traffic_submit */
static void load_submit (const char *plugin_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));
+ sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
- strcpy (vl.type, "load");
++ sstrncpy (vl.type, "load", sizeof (vl.type));
- plugin_dispatch_values ("load", &vl);
+ plugin_dispatch_values (&vl);
}
static void submit_gauge (const char *plugin_instance, const char *type,
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));
+ sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
+ sstrncpy (vl.type, type, sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void submit_gauge */
static inline long long __get_sock_bytes(const char *s)
diff --cc src/wireless.c
index a0644fe490a4bef130a9ecff552124e106a7d220,0edaf458688bcddd3dcce19c42652be93ece2e52..21bbcb401b141e0c09bb7f2a1cb8ce1db5f881b6
--- 1/src/wireless.c
--- 2/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,
+ sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
+ sstrncpy (vl.type, type, sizeof (vl.type));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void wireless_submit */
#define POWER_MIN -90.0
diff --cc src/xmms.c
index 01c7e0cfea9214cf536083614a2a9ac1b33129e8,7f3edf0a27fd762d3b18f93ff4c8f2a0a8a05a16..09786fc9282b6f01bd8568750b771e4f8df039ea
--- 1/src/xmms.c
--- 2/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));
+ sstrncpy (vl.type, type, sizeof (vl.type));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void cxmms_submit */
int cxmms_read (void)