Skip to content

Commit

Permalink
ssl_tls12_server: fix potential NULL-dereferencing if local certifica…
Browse files Browse the repository at this point in the history
…te was not set.

Signed-off-by: Leonid Rozenboim <leonid.rozenboim@oracle.com>
  • Loading branch information
leorosen authored and daverodgman committed Aug 19, 2022
1 parent 928527c commit 81e7423
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion library/ssl_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3903,8 +3903,14 @@ static int ssl_decrypt_encrypted_pms( mbedtls_ssl_context *ssl,
size_t peer_pmssize )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;

mbedtls_x509_crt *own_cert = mbedtls_ssl_own_cert( ssl );
if( own_cert == NULL ) {
MBEDTLS_SSL_DEBUG_MSG( 1, ( "got no local certificate" ) );
return( MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE );
}
mbedtls_pk_context *public_key = &own_cert->pk;
mbedtls_pk_context *private_key = mbedtls_ssl_own_key( ssl );
mbedtls_pk_context *public_key = &mbedtls_ssl_own_cert( ssl )->pk;
size_t len = mbedtls_pk_get_len( public_key );

#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
Expand Down

0 comments on commit 81e7423

Please sign in to comment.