summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Valter <d-valter@yandex-team.ru>2022-04-08 10:08:32 +0000
committerDamjan Marion <dmarion@me.com>2022-04-08 16:15:32 +0000
commit1c8c6d302af494c963842de06910d3c1c8187e42 (patch)
treee990bf6af8f09619c7e3abc9d286b5c90b96357e
parentd5045e68a782d484e3f0e54edb4a88dc3dfac291 (diff)
stats: fix vector overrun in expend check
Do not access allocated elements beyond the end of the vector. They are allocated, but not yet valid both logically (they are at best NULLs) and according to ASAN. Type: fix Change-Id: Iaf43767d6d3bd4c24c7c5a0ba9b3410bbeeb0556 Signed-off-by: Dmitry Valter <d-valter@yandex-team.ru>
-rw-r--r--src/vlib/stats/stats.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vlib/stats/stats.c b/src/vlib/stats/stats.c
index cb29ddaf378..a19909d0dc4 100644
--- a/src/vlib/stats/stats.c
+++ b/src/vlib/stats/stats.c
@@ -354,7 +354,7 @@ vlib_stats_validate_will_expand_internal (u32 entry_index, va_list *va)
u32 idx1 = va_arg (*va, u32);
u64 **data = e->data;
- if (idx0 >= vec_max_len (data))
+ if (idx0 >= vec_len (data))
goto done;
for (u32 i = 0; i <= idx0; i++)
@@ -369,7 +369,7 @@ vlib_stats_validate_will_expand_internal (u32 entry_index, va_list *va)
va_end (*va);
- if (idx0 >= vec_max_len (data))
+ if (idx0 >= vec_len (data))
goto done;
for (u32 i = 0; i <= idx0; i++)