aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2017-06-07 12:30:48 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2017-06-07 12:41:39 +0000
commit0018a3e54efcf6dfbc08ae307b366ee6c4fb3257 (patch)
tree1d21283d7b5a0e5f1196c65521fea5b39c6d68f8 /src/plugins
parent539ed4fee56aaec0f44508ed2baa24beb1c678f8 (diff)
acl-plugin: fix coverity error in acl_test.c
Attempting to supply within a VAT CLI to add the ACLs a rule count override with no rules to add would result in null pointer dereference as we attempt to copy those rules to the message. Add the check to avoid copy if the source pointer is null (i.e. if there are no rules to copy from). This commit fixes coverity errors 166797 and 166792. Change-Id: Icabe060d961ba07dc41f63b8e17fca12ff82aa29 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/acl/acl_test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/acl/acl_test.c b/src/plugins/acl/acl_test.c
index 6154a238ff9..8f6179f8f33 100644
--- a/src/plugins/acl/acl_test.c
+++ b/src/plugins/acl/acl_test.c
@@ -480,7 +480,7 @@ static int api_acl_add_replace (vat_main_t * vam)
memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_ACL_ADD_REPLACE + sm->msg_id_base);
mp->client_index = vam->my_client_index;
- if (n_rules > 0)
+ if ((n_rules > 0) && rules)
clib_memcpy(mp->r, rules, n_rules*sizeof (vl_api_acl_rule_t));
if (tag)
{
@@ -934,7 +934,7 @@ static int api_macip_acl_add (vat_main_t * vam)
memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_MACIP_ACL_ADD + sm->msg_id_base);
mp->client_index = vam->my_client_index;
- if (n_rules > 0)
+ if ((n_rules > 0) && rules)
clib_memcpy(mp->r, rules, n_rules*sizeof (mp->r[0]));
if (tag)
{