X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdns.c;h=c04169fec8a4809cb9e7b5516b5011e8d49a6e3a;hb=2c2e9a297f59c110ddd4adef6293fe80f39f15b7;hp=2cbd0c37dd321e1b133ddfbfc8e38bb502bb31b8;hpb=7c6b8505e5557622158574c8dce8ba53c53cec72;p=collectd.git diff --git a/src/dns.c b/src/dns.c index 2cbd0c37..c04169fe 100644 --- a/src/dns.c +++ b/src/dns.c @@ -229,13 +229,11 @@ static void *dns_child_loop (void *dummy) memset (&fp, 0, sizeof (fp)); if (pcap_compile (pcap_obj, &fp, "udp port 53", 1, 0) < 0) { - DEBUG ("pcap_compile failed"); ERROR ("dns plugin: pcap_compile failed"); return (NULL); } if (pcap_setfilter (pcap_obj, &fp) < 0) { - DEBUG ("pcap_setfilter failed"); ERROR ("dns plugin: pcap_setfilter failed"); return (NULL); } @@ -301,11 +299,12 @@ static void submit_counter (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, "dns"); - strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "dns", sizeof (vl.plugin)); + 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) @@ -319,10 +318,11 @@ 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"); + 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)