summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vapi/vapi_internal.h
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2021-11-15 15:52:37 +0100
committerOle Tr�an <otroan@employees.org>2021-11-16 10:30:50 +0000
commita25ce96ba35f001b974cb32e008efb7ef46710e4 (patch)
tree9171af550df796acd68a25801fae7ec02ced5cb6 /src/vpp-api/vapi/vapi_internal.h
parent5f07b6bd5478d7ee6e7a7c60df922552913d9618 (diff)
vapi: verify message size when received
Verifying message size including VLA size allows to dismiss some coverity warnings in generated code. Type: improvement Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I824658881254b3e7a9bfca228a266cfee448cc2e
Diffstat (limited to 'src/vpp-api/vapi/vapi_internal.h')
-rw-r--r--src/vpp-api/vapi/vapi_internal.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vpp-api/vapi/vapi_internal.h b/src/vpp-api/vapi/vapi_internal.h
index e9a9726d86e..49c041769d0 100644
--- a/src/vpp-api/vapi/vapi_internal.h
+++ b/src/vpp-api/vapi/vapi_internal.h
@@ -82,6 +82,7 @@ typedef vapi_error_e (*vapi_cb_t) (struct vapi_ctx_s *, void *, vapi_error_e,
bool, void *);
typedef void (*generic_swap_fn_t) (void *payload);
+typedef int (*verify_msg_size_fn_t) (void *msg, uword buf_size);
typedef struct
{
@@ -92,7 +93,7 @@ typedef struct
bool has_context;
unsigned int context_offset;
unsigned int payload_offset;
- size_t size;
+ verify_msg_size_fn_t verify_msg_size;
generic_swap_fn_t swap_to_be;
generic_swap_fn_t swap_to_host;
vapi_msg_id_t id; /* assigned at run-time */
@@ -122,7 +123,6 @@ void vapi_store_request (vapi_ctx_t ctx, u32 context, bool is_dump,
int vapi_get_payload_offset (vapi_msg_id_t id);
void (*vapi_get_swap_to_host_func (vapi_msg_id_t id)) (void *payload);
void (*vapi_get_swap_to_be_func (vapi_msg_id_t id)) (void *payload);
-size_t vapi_get_message_size (vapi_msg_id_t id);
size_t vapi_get_context_offset (vapi_msg_id_t id);
bool vapi_msg_is_with_context (vapi_msg_id_t id);
size_t vapi_get_message_count();