*/
struct rte_metrics_meta_s {
/** Name of metric */
- char name[RTE_METRICS_MAX_NAME_LEN + 1];
+ char name[RTE_METRICS_MAX_NAME_LEN];
/** Current value for metric */
uint64_t value[RTE_MAX_ETHPORTS];
/** Used for global metrics */
entry = &stats->metadata[idx_name + stats->cnt_stats];
strncpy(entry->name, names[idx_name],
RTE_METRICS_MAX_NAME_LEN);
+ /* Enforce NULL-termination */
+ entry->name[RTE_METRICS_MAX_NAME_LEN - 1] = '\0';
memset(entry->value, 0, sizeof(entry->value));
entry->idx_next_stat = idx_name + stats->cnt_stats + 1;
}
* is required for updating said metric's value.
*
* @param name
- * Metric name
+ * Metric name. If this exceeds RTE_METRICS_MAX_NAME_LEN (including
+ * the NULL terminator), it is truncated.
*
* @return
* - Zero or positive: Success (index key of new metric)