diff --git a/userspace/libsinsp/plugin.cpp b/userspace/libsinsp/plugin.cpp index d7f57b1a64..cadd90a642 100755 --- a/userspace/libsinsp/plugin.cpp +++ b/userspace/libsinsp/plugin.cpp @@ -19,6 +19,7 @@ limitations under the License. #include #include +#include #include #include #include @@ -939,11 +940,7 @@ std::vector sinsp_plugin::get_metrics() const metrics_v2 metric; //copy plugin name - int s = strlcpy(metric.name, m_name.c_str(), METRIC_NAME_MAX); - //copy dot - strlcpy(metric.name + s, ".", METRIC_NAME_MAX); - //copy metric name - strlcpy(metric.name + s + 1, plugin_metric->name, METRIC_NAME_MAX); + snprintf(metric.name, METRIC_NAME_MAX, "%s.%s", m_name.c_str(), plugin_metric->name); metric.flags = METRICS_V2_PLUGINS; metric.unit = METRIC_VALUE_UNIT_COUNT; @@ -1083,7 +1080,7 @@ ss_plugin_rc sinsp_plugin::handle_plugin_async_event(ss_plugin_owner_t *o, const try { - auto evt = std::unique_ptr(new sinsp_evt()); + auto evt = std::make_unique(); ASSERT(evt->get_scap_evt_storage() == nullptr); evt->set_scap_evt_storage(new char[e->len]); memcpy(evt->get_scap_evt_storage(), e, e->len);