Ruben Kerkhof [Wed, 16 May 2018 11:24:55 +0000 (13:24 +0200)]
Fix make distcheck on Mac OS
CC src/libcollectdclient/libcollectdclient_la-network_parse.lo
../../src/libcollectdclient/network_parse.c:49:10: fatal error: 'stdendian.h' file not found
^~~~~~~~~~~~~
1 error generated.
Ruben Kerkhof [Tue, 15 May 2018 20:03:00 +0000 (22:03 +0200)]
table plugin: fix truncation warnings
CC src/table.lo
src/table.c: In function ‘tbl_read_table’:
src/table.c:396:66: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s",
^
src/table.c:396:7: note: ‘snprintf’ output 2 or more bytes (assuming 129) into a destination of size 128
snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
res->instance_prefix, instances_str);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ruben Kerkhof [Tue, 15 May 2018 19:20:24 +0000 (21:20 +0200)]
virt plugin: fix truncation warning
src/virt.c: In function ‘refresh_lists’:
src/virt.c:2123:61: warning: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size 5 [-Wformat-truncation=]
snprintf(number_string, sizeof(number_string), "interface-%u", number);
^~
src/virt.c:2123:50: note: directive argument in the range [1, 2147483647]
snprintf(number_string, sizeof(number_string), "interface-%u", number);
^~~~~~~~~~~~~~
src/virt.c:2123:3: note: ‘snprintf’ output between 12 and 21 bytes into a destination of size 15
snprintf(number_string, sizeof(number_string), "interface-%u", number);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ruben Kerkhof [Tue, 15 May 2018 19:05:27 +0000 (21:05 +0200)]
netlink plugin: fix truncation warnings
CC src/netlink_la-netlink.lo
src/netlink.c: In function ‘qos_filter_cb’:
src/netlink.c:544:58: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size between 121 and 122 [-Wformat-truncation=]
snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
^~ ~~~~~~~
src/netlink.c:544:7: note: ‘snprintf’ output between 7 and 135 bytes into a destination of size 128
snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/netlink.c:577:58: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size between 121 and 122 [-Wformat-truncation=]
snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
^~ ~~~~~~~
src/netlink.c:577:7: note: ‘snprintf’ output between 7 and 135 bytes into a destination of size 128
snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CCLD netlink.la
write_redis: fix "max_set_duration" deletes unexpected data
The calculation result of the data range
when "max_set_duration" is used is incorrect,
because the (char []) type, i.e. string, variable "time" is used
as the number for the time calculation.
As a result, data in the wrong range is deleted.
With this change, the correct data is deleted
by calculation using a double type value.
Ruben Kerkhof [Mon, 14 May 2018 22:27:58 +0000 (00:27 +0200)]
nut plugin: fix warning
CC src/nut_la-nut.lo
In function ‘nut_ca_path’,
inlined from ‘nut_config.part.1’ at src/nut.c:181:12,
inlined from ‘nut_config’:
src/nut.c:148:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
strncpy(ca_path, value, (strlen(value) + 1));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/nut.c: In function ‘nut_config’:
src/nut.c:148:30: note: length computed here
strncpy(ca_path, value, (strlen(value) + 1));
^~~~~~~~~~~~~
CCLD nut.la
Ruben Kerkhof [Sun, 13 May 2018 15:06:54 +0000 (17:06 +0200)]
write_sensu: use sstrncpy
Fixes:
CC src/write_sensu.lo
src/write_sensu.c: In function ‘replace_str’:
src/write_sensu.c:630:3: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
strncpy(r, p, strlen(p));
^~~~~~~~~~~~~~~~~~~~~~~~
CCLD write_sensu.la
Pavel Rochnyack [Mon, 7 May 2018 15:53:23 +0000 (22:53 +0700)]
netlink plugin: Use of less strict rules in link_filter_cb()
mnl_attr_validate2() function implements strict equality check of kernel and
userspace structures size. Additional counters was added to 4.6 Linux kernel,
sizes was changed and mismatch can occur.
This patch weakened validation.
Now Collectd just checks if structures, received from kernel space, has enough
data.
CC src/libcollectdclient/libcollectdclient_la-server.lo
In file included from src/libcollectdclient/server.c:37:
/usr/include/net/if.h:121: error: field 'ifi_lastchange' has incomplete type
/usr/include/net/if.h:369: error: field 'ifru_addr' has incomplete type
/usr/include/net/if.h:370: error: field 'ifru_dstaddr' has incomplete type
/usr/include/net/if.h:371: error: field 'ifru_broadaddr' has incomplete type
/usr/include/net/if.h:399: error: field 'ifrau_addr' has incomplete type
/usr/include/net/if.h:405: error: field 'ifra_dstaddr' has incomplete type
/usr/include/net/if.h:407: error: field 'ifra_mask' has incomplete type
/usr/include/net/if.h:450: error: field 'addr' has incomplete type
/usr/include/net/if.h:451: error: field 'dstaddr' has incomplete type
/usr/include/net/if.h:457: error: expected specifier-qualifier-list before 'sa_family_t'
In file included from /usr/include/net/if.h:466,
from src/libcollectdclient/server.c:37:
/usr/include/net/if_arp.h:79: error: field 'arp_pa' has incomplete type
/usr/include/net/if_arp.h:80: error: field 'arp_ha' has incomplete type
*** Error 1 in . (Makefile:6017 'src/libcollectdclient/libcollectdclient_la-server.lo': @echo " CC " src/libcollectdclient/libcollectd...)
*** Error 1 in /home/ruben/src/collectd (Makefile:4188 'all')
src/daemon/collectd.c:579:9: warning: declaration shadows a local variable [-Wshadow]
int status;
^
src/daemon/collectd.c:558:7: note: previous declaration is here
int status;
^
src/daemon/collectd.c:499:5: warning: no previous prototype for function 'configure_collectd' [-Wmissing-prototypes]
int configure_collectd(struct cmdline_config *config) {
^
CC src/filecount.lo
src/filecount.c:66:6: warning: no previous prototype for function 'fc_free_dir' [-Wmissing-prototypes]
void fc_free_dir(fc_directory_conf_t *dir) {
^
1 warning generated.
Kavanagh, Mark B [Tue, 27 Feb 2018 17:28:55 +0000 (17:28 +0000)]
utils_ovs: fix resource leaks
In ovs_db_init(), upon failure of either ovs_db_event_thread_init()
and/or ovs_db_poll_thread_init(), ovs_db_destroy() is invoked, in
order to release OVSDB data resources.
However, in the event that ovs_db_destroy() returns an error value,
some OVSDB resources are never released, and are consequently lost.
Resolve this issue by checking the return value of ovs_db_destroy()
and manually releasing the appropriate resources accordingly.
Fixes: 5a90d0e ("ovs_events: Address PR comments") Signed-off-by: Kavanagh, Mark B <mark.b.kavanagh@intel.com>
Kavanagh, Mark B [Mon, 26 Feb 2018 17:08:31 +0000 (17:08 +0000)]
utils_ovs: fix potential NULL
In ovs_utils_get_map_value(), YAJL_GET_ARRAY may return a NULL
pointer, which is subsequently dereferenced. Ensure that the
pointer is non-NULL before proceeding.
Fixes: 12f6497 ("ovs_events: Add external ids as metadata") Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Kavanagh, Mark B [Mon, 26 Feb 2018 16:12:26 +0000 (16:12 +0000)]
utils_ovs: fix potential NULL-string dereference
In ovs_utils_get_map_value(), a potential NULL-string, returned
by YAJL_GET_STRING(), is passed to strcmp, and subsequently
dereferenced. Ensure that said string is non-NULL.
Kavanagh, Mark B [Mon, 26 Feb 2018 14:49:00 +0000 (14:49 +0000)]
ovs_stats: fix potential NULL array dereference
In ovs_stats_update_bridge(), YAJL_GET_ARRAY() may return a NULL
pointer. Ensure that a non-NULL pointer is returned, before
attempting to dererence same.