api: check id is valid for bounce checking 71/24471/4
authorBenoît Ganne <bganne@cisco.com>
Tue, 21 Jan 2020 17:33:14 +0000 (18:33 +0100)
committerDave Barach <openvpp@barachs.net>
Mon, 15 Jun 2020 19:04:25 +0000 (19:04 +0000)
If the id is invalid we cannot check whether we must free the message or
not, free it anyway.

Type: fix

Change-Id: Ie4426f601390d1e5e14c739f670e8c1e6e3aaf1e
Signed-off-by: Benoît Ganne <bganne@cisco.com>
src/vlibapi/api_shared.c

index c818668..caad6e5 100644 (file)
@@ -639,7 +639,7 @@ vl_msg_api_handler_with_vm_node (api_main_t * am, svm_region_t * vlib_rp,
    * Special-case, so we can e.g. bounce messages off the vnet
    * main thread without copying them...
    */
-  if (!(am->message_bounce[id]))
+  if (id >= vec_len (am->message_bounce) || !(am->message_bounce[id]))
     vl_msg_api_free (the_msg);
 
   if (PREDICT_FALSE (am->elog_trace_api_messages))