mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-06 03:40:04 +00:00
cipher: check that ctx_alloc_func is not NULL before calling it
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
a6c0761c43
commit
79a02de79f
@ -263,7 +263,8 @@ int mbedtls_cipher_setup(mbedtls_cipher_context_t *ctx,
|
||||
|
||||
memset(ctx, 0, sizeof(mbedtls_cipher_context_t));
|
||||
|
||||
if (NULL == (ctx->cipher_ctx = mbedtls_cipher_get_base(cipher_info)->ctx_alloc_func())) {
|
||||
if ((mbedtls_cipher_get_base(cipher_info)->ctx_alloc_func != NULL) &&
|
||||
(ctx->cipher_ctx = mbedtls_cipher_get_base(cipher_info)->ctx_alloc_func()) == NULL) {
|
||||
return MBEDTLS_ERR_CIPHER_ALLOC_FAILED;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user