misc: fix tracedump API 10/38910/2
authorMaxime Peim <mpeim@cisco.com>
Fri, 26 May 2023 07:52:35 +0000 (07:52 +0000)
committerBeno�t Ganne <bganne@cisco.com>
Tue, 30 May 2023 09:16:22 +0000 (09:16 +0000)
In some cases, in the trace dump v2 dump function, we iterate over the
client cache even though this one could be empty.

Type: fix
Change-Id: Ice5cefa25bb93dabe86fe565347cdc32faa674ac
Signed-off-by: Maxime Peim <mpeim@cisco.com>
src/plugins/tracedump/tracedump.c

index 0c0f3b4..10107ac 100644 (file)
@@ -420,7 +420,8 @@ vl_api_trace_v2_dump_t_handler (vl_api_trace_v2_dump_t *mp)
   /* Save the cache, one way or the other */
   tdmp->traces[client_index] = client_trace_cache;
 
-  for (i = first_thread_id; i <= last_thread_id; i++)
+  for (i = first_thread_id;
+       i <= last_thread_id && i < vec_len (client_trace_cache); i++)
     {
       // dump a number of 'max' packets per thead
       for (j = first_position;