From b1b4b5cf58aa6247bb0df9163843fce81cedf1de Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Wed, 6 Nov 2019 14:21:07 +0100 Subject: crypto: do not crash if no crypto engine loaded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not overflow ops_handlers vector. Type: fix Change-Id: I8d5e7fb8125a7bd87ecfe6f4f1390fb9f43dad8f Signed-off-by: Benoît Ganne (cherry picked from commit 6545df7913b53d71415c7c9643cb824c2ffbaaa7) --- src/vnet/crypto/crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vnet') 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 -- cgit 1.2.3-korg