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.
Mark Kavanagh [Wed, 21 Feb 2018 16:15:01 +0000 (16:15 +0000)]
ovs_stats: fix potential NULL-string dereference
The YAJL_GET_STRING macro may return NULL; ensure that the returned
string is non-NULL, before passing it to ovs_stats_new_port(), within
the context of the ovs_stats_update_bridge() function.
Since this change introduces another return path, a single 'failure'
return point is introduced to ovs_stats_bridge().
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Mark Kavanagh [Mon, 19 Feb 2018 15:55:45 +0000 (15:55 +0000)]
utils_ovs: fix potential strcmp() NULL ptr param
YAJL_GET_STRING(array_values[0]) may return NULL if
array_values[0]->string is NULL; passing a NULL parameter to
strcmp() is not recommended, since the resultant behaviour may
be undefined.
Resolve the issue by adding a NULL check for the string returned
by YAJL_GET_STRING.
Mark Kavanagh [Mon, 19 Feb 2018 13:48:12 +0000 (13:48 +0000)]
ovs_stats: fix potential NULL dereference
ovs_stats_new_port() accepts a character pointer, uuid, as a parameter,
and copies it into port->uuid. Later, this value is dereferenced in
ovs_stats_update_bridge(). If uuid was NULL, then a SEGV will occur.
Resolve this issue by checking if uuid is NULL in ovs_stats_new_port().
Harry van Haaren [Wed, 21 Mar 2018 15:33:00 +0000 (15:33 +0000)]
dpdk: increase buffer size for parsing lcores
This commit increases the size of the "high_str" buffer,
which is later used by the strncpy() function. Static analysis
showed that there was a potential issue in accessing this string
if the buffer is smaller.
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>