summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2023-01-05 10:56:26 +0100
committerDamjan Marion <dmarion@0xa5.net>2023-03-06 14:26:26 +0000
commit1ee334c6f86b3e814aca1443ec7dfccdfc34ab26 (patch)
treeefa113d19b2b789dfed054546ded13a12f74d553
parentd69233f44ea1f039e7755358c0acb20bfbec2258 (diff)
crypto: make it easier to diagnose keys use-after-free
Type: improvement Change-Id: Ib98eba146e24e659acf3b9a228b81fcd641f4c67 Signed-off-by: Benoît Ganne <bganne@cisco.com>
-rw-r--r--src/vnet/crypto/crypto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vnet/crypto/crypto.c b/src/vnet/crypto/crypto.c
index f8926c9734a..156dab46517 100644
--- a/src/vnet/crypto/crypto.c
+++ b/src/vnet/crypto/crypto.c
@@ -469,12 +469,12 @@ vnet_crypto_key_del (vlib_main_t * vm, vnet_crypto_key_index_t index)
if (key->type == VNET_CRYPTO_KEY_TYPE_DATA)
{
- clib_memset (key->data, 0, vec_len (key->data));
+ clib_memset (key->data, 0xfe, vec_len (key->data));
vec_free (key->data);
}
else if (key->type == VNET_CRYPTO_KEY_TYPE_LINK)
{
- key->index_crypto = key->index_integ = 0;
+ key->index_crypto = key->index_integ = ~0;
}
pool_put (cm->keys, key);