Merge branch 'collectd-4.4'
[collectd.git] / src / ntpd.c
index 600c0a3..22bbc5d 100644 (file)
@@ -301,9 +301,9 @@ static void ntpd_submit (char *type, char *type_inst, double value)
        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));
        sstrncpy (vl.type, type, sizeof (vl.type));
        sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
 
@@ -613,7 +613,7 @@ static int ntpd_receive_response (int *res_items, int *res_size,
                if (pkt_item_len < res_item_size)
                        pkt_padding = res_item_size - pkt_item_len;
                DEBUG ("res_item_size = %i; pkt_padding = %i;",
-                               res_item_size, pkt_padding);
+                               res_item_size, (int) pkt_padding);
 
                /* Extract the sequence number */
                pkt_sequence = INFO_SEQ (res.auth_seq);
@@ -652,7 +652,7 @@ static int ntpd_receive_response (int *res_items, int *res_size,
                 * We start by allocating some more memory.
                 */
                DEBUG ("realloc (%p, %i)", (void *) *res_data,
-                               (items_num + pkt_item_num) * res_item_size);
+                               (int) (items_num + pkt_item_num) * res_item_size);
                items = realloc ((void *) *res_data,
                                (items_num + pkt_item_num) * res_item_size);
                if (items == NULL)