diff --git a/userspace/falco/stats_writer.cpp b/userspace/falco/stats_writer.cpp index 0d8cde11..32c555a2 100644 --- a/userspace/falco/stats_writer.cpp +++ b/userspace/falco/stats_writer.cpp @@ -250,7 +250,7 @@ void stats_writer::collector::get_metrics_output_fields_additional( for(uint32_t stat = 0; stat < nstats; stat++) { char metric_name[STATS_NAME_MAX] = "falco."; - strncat(metric_name, utilization[stat].name, sizeof(metric_name) - strlen(metric_name)); + strncat(metric_name, utilization[stat].name, sizeof(metric_name) - strlen(metric_name) - 1); switch(utilization[stat].type) { case STATS_VALUE_TYPE_U64: @@ -313,7 +313,7 @@ void stats_writer::collector::get_metrics_output_fields_additional( // todo: as we expand scap_stats_v2 prefix may be pushed to scap or we may need to expand // functionality here for example if we add userspace syscall counters that should be prefixed w/ `falco.` char metric_name[STATS_NAME_MAX] = "scap."; - strncat(metric_name, stats_v2[stat].name, sizeof(metric_name) - strlen(metric_name)); + strncat(metric_name, stats_v2[stat].name, sizeof(metric_name) - strlen(metric_name) - 1); switch(stats_v2[stat].type) { case STATS_VALUE_TYPE_U64: