diff options
author | Benoît Ganne <bganne@cisco.com> | 2021-06-08 16:27:38 +0200 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2021-06-16 07:41:31 +0000 |
commit | 26c6fffa7ac30bda79432a6d46d6dd5d286b7cb6 (patch) | |
tree | 58e55750328679f76c73af2e1ded7f68604893ee /src | |
parent | c863a9134051f5651a829547fdcdc1a0d7b14831 (diff) |
stats: fix counters name overflow
sm_directory_vector_by_name is a C-string hashtable, make sure the names
are NULL-terminated.
Type: fix
Change-Id: If44456ef9da69ed012f2b981b58ce732663af67d
Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vpp/stats/stat_segment_provider.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/vpp/stats/stat_segment_provider.c b/src/vpp/stats/stat_segment_provider.c index fc883f7751d..766261ce0e0 100644 --- a/src/vpp/stats/stat_segment_provider.c +++ b/src/vpp/stats/stat_segment_provider.c @@ -88,10 +88,10 @@ vlib_stats_register_mem_heap (clib_mem_heap_t *heap) u32 heap_index = vec_len (memory_heaps_vec) - 1; /* Memory counters provider */ - u8 *s = format (0, "/mem/%s", heap->name); - u8 *s_used = format (0, "/mem/%s/used", heap->name); - u8 *s_total = format (0, "/mem/%s/total", heap->name); - u8 *s_free = format (0, "/mem/%s/free", heap->name); + u8 *s = format (0, "/mem/%s%c", heap->name, 0); + u8 *s_used = format (0, "/mem/%s/used%c", heap->name, 0); + u8 *s_total = format (0, "/mem/%s/total%c", heap->name, 0); + u8 *s_free = format (0, "/mem/%s/free%c", heap->name, 0); mem_vector_index = stat_segment_new_entry (s, STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE); vec_free (s); @@ -174,7 +174,7 @@ stat_provider_register_vector_rate (u32 num_workers) { int i; - u8 *s = format (0, "/sys/vector_rate"); + u8 *s = format (0, "/sys/vector_rate%c", 0); i = stat_segment_new_entry (s, STAT_DIR_TYPE_SCALAR_INDEX); if (i == ~0) @@ -182,7 +182,7 @@ stat_provider_register_vector_rate (u32 num_workers) vec_free (s); stat_segment_poll_add (i, stat_provider_vector_rate_update_fn, ~0, 10); - s = format (0, "/sys/vector_rate_per_worker"); + s = format (0, "/sys/vector_rate_per_worker%c", 0); i = stat_segment_new_entry (s, STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE); if (i == ~0) ASSERT (0); |