X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fovs_events.c;h=ef59b4c27f7f96cdd61785e67c5e026d88299129;hb=b788e9e0f84a324b68cbfc8168a1b5610c921389;hp=afa11997cfc3a1ec8fadd50a29db39c1d0ecd7b3;hpb=196f5bd17880d91ba0da33a8f5f6168d039cfa0c;p=collectd.git diff --git a/src/ovs_events.c b/src/ovs_events.c index afa11997..ef59b4c2 100644 --- a/src/ovs_events.c +++ b/src/ovs_events.c @@ -253,8 +253,8 @@ static int ovs_events_plugin_config(oconfig_item_t *ci) { ovs_events_config_free(); return -1; } - strncpy(ovs_events_ctx.config.ovs_db_serv, service, - sizeof(ovs_events_ctx.config.ovs_db_serv)); + sstrncpy(ovs_events_ctx.config.ovs_db_serv, service, + sizeof(ovs_events_ctx.config.ovs_db_serv)); sfree(service); } else if (strcasecmp("Socket", child->key) == 0) { if (cf_util_get_string_buffer( @@ -404,14 +404,14 @@ static int ovs_events_get_iface_info(yajl_val jobject, if (!YAJL_IS_OBJECT(jobject)) return -1; - /* zero the interface info structure */ - memset(ifinfo, 0, sizeof(*ifinfo)); - /* try to find external_ids, name and link_state fields */ jexternal_ids = ovs_utils_get_value_by_key(jobject, "external_ids"); if (jexternal_ids == NULL || ifinfo == NULL) return -1; + /* zero the interface info structure */ + memset(ifinfo, 0, sizeof(*ifinfo)); + /* get iface-id from external_ids field */ jvalue = ovs_utils_get_map_value(jexternal_ids, "iface-id"); if (jvalue != NULL && YAJL_IS_STRING(jvalue))