summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-11-06 14:21:07 +0100
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-11-19 12:17:48 +0000
commitb1b4b5cf58aa6247bb0df9163843fce81cedf1de (patch)
treeea1eb5c44950e9c25f37bc483aa9d4dd8170e79e /src
parent7dfe1ac660b75e6da5a95af385fb4d1eebfdb44e (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> (cherry picked from commit 6545df7913b53d71415c7c9643cb824c2ffbaaa7)
Diffstat (limited to 'src')
-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 4da8a14a14b..4a72b7cd116 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