From c8c12b6007b4249e1fbc67c94bb28b3ec2dadc3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 2 Jul 2018 13:09:39 +0200 Subject: [PATCH] Add NULL pointer check for consistency Most other functions in this module have a similar check. --- library/pk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/pk.c b/library/pk.c index c793fd8e4..ba8950e8d 100644 --- a/library/pk.c +++ b/library/pk.c @@ -206,8 +206,8 @@ static inline int pk_hashlen_helper( mbedtls_md_type_t md_alg, size_t *hash_len static int pk_restart_setup( mbedtls_pk_restart_ctx *ctx, const mbedtls_pk_info_t *info ) { - /* Don't do anything it already set up */ - if( ctx->pk_info != NULL ) + /* Don't do anything if already set up or invalid */ + if( ctx == NULL || ctx->pk_info != NULL ) return( 0 ); /* Should never happen when we're called */