From c2fc57e8df45c0ddcd39c8b3d34e1b02e290e5ab Mon Sep 17 00:00:00 2001 From: Klement Sekera Date: Thu, 28 Jun 2018 14:20:12 +0200 Subject: ipsec: fix VPP-1333 - crash in ipsec policy cli Change-Id: I843d094b6bbd1cefba82d6026174be005e66d510 Signed-off-by: Klement Sekera --- src/vnet/ipsec/ipsec_cli.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') 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) { -- cgit 1.2.3-korg