aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2018-06-28 14:20:12 +0200
committerDamjan Marion <dmarion@me.com>2018-06-29 10:01:00 +0000
commitc2fc57e8df45c0ddcd39c8b3d34e1b02e290e5ab (patch)
treedb7e1e432a97c0e59181e54e2f254031417f0c45
parent91ce84374167e2b23557aae4a2472acfc6fa7c09 (diff)
ipsec: fix VPP-1333 - crash in ipsec policy cli
Change-Id: I843d094b6bbd1cefba82d6026174be005e66d510 Signed-off-by: Klement Sekera <ksekera@cisco.com>
-rw-r--r--src/vnet/ipsec/ipsec_cli.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vnet/ipsec/ipsec_cli.c b/src/vnet/ipsec/ipsec_cli.c
index 84c57b2adb7..6a97b7bc8d9 100644
--- a/src/vnet/ipsec/ipsec_cli.c
+++ b/src/vnet/ipsec/ipsec_cli.c
@@ -344,6 +344,12 @@ ipsec_policy_add_del_command_fn (vlib_main_t * vm,
ipsec_main_t *im = &ipsec_main;
ipsec_sa_t *sa = 0;
p1 = hash_get (im->sa_index_by_sa_id, p.sa_id);
+ if (!p1)
+ {
+ error =
+ clib_error_return (0, "SA with index %u not found", p.sa_id);
+ goto done;
+ }
sa = pool_elt_at_index (im->sad, p1[0]);
if (sa && sa->protocol == IPSEC_PROTOCOL_AH && is_add && p.is_ipv6)
{