vapi: fix verification for reply message 92/39292/4
authorSylvain Cadilhac <[email protected]>
Wed, 26 Jul 2023 14:16:47 +0000 (16:16 +0200)
committerOle Tr�an <[email protected]>
Wed, 6 Sep 2023 08:23:55 +0000 (08:23 +0000)
Type: fix
Byte swapping should be done before verifying message otherwise the message length will be wrongly computed.

Change-Id: I90b2f60bd33e5362e0edd5ee425f6a6f07886f1e
Signed-off-by: Sylvain Cadilhac <[email protected]>
src/vpp-api/vapi/vapi.c

index 45241e1..46ccf37 100644 (file)
@@ -1261,13 +1261,13 @@ vapi_dispatch_one (vapi_ctx_t ctx)
       return VAPI_EINVAL;
     }
   const vapi_msg_id_t id = ctx->vl_msg_id_to_vapi_msg_t[vpp_id];
+  vapi_get_swap_to_host_func (id) (msg);
   if (vapi_verify_msg_size (id, msg, size))
     {
       vapi_msg_free (ctx, msg);
       return VAPI_EINVAL;
     }
   u32 context;
-  vapi_get_swap_to_host_func (id) (msg);
   if (vapi_msg_is_with_context (id))
     {
       context = *(u32 *) (((u8 *) msg) + vapi_get_context_offset (id));