aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-11-06 14:21:07 +0100
committerNeale Ranns <nranns@cisco.com>2019-11-13 14:48:48 +0000
commit6545df7913b53d71415c7c9643cb824c2ffbaaa7 (patch)
tree7426124e31b24ac49b81083e847f04d3ccbf349a
parent069e2a734cf75f4d151efe49d1efc51bc82cedb2 (diff)
crypto: do not crash if no crypto engine loaded
Do not overflow ops_handlers vector. Type: fix Change-Id: I8d5e7fb8125a7bd87ecfe6f4f1390fb9f43dad8f Signed-off-by: Benoît Ganne <bganne@cisco.com>
-rw-r--r--src/vnet/crypto/crypto.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vnet/crypto/crypto.c b/src/vnet/crypto/crypto.c
index c465f14b7f9..6cd12108f6c 100644
--- a/src/vnet/crypto/crypto.c
+++ b/src/vnet/crypto/crypto.c
@@ -134,7 +134,7 @@ vnet_crypto_is_set_handler (vnet_crypto_alg_t alg)
{
vnet_crypto_main_t *cm = &crypto_main;
- return (NULL != cm->ops_handlers[alg]);
+ return (alg < vec_len (cm->ops_handlers) && NULL != cm->ops_handlers[alg]);
}
void