mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-28 19:13:28 +00:00
Avoid potential NULL dereference.
May happen with a faulty configuration (eg no allowed curve but trying to use ECDHE key exchange), but not trigger able remotely. (Found with Clang's scan-build.)
This commit is contained in:
parent
14bf7063b9
commit
b86145e6cd
@ -2647,7 +2647,6 @@ static int ssl_write_server_key_exchange( mbedtls_ssl_context *ssl )
|
|||||||
* } ServerECDHParams;
|
* } ServerECDHParams;
|
||||||
*/
|
*/
|
||||||
const mbedtls_ecp_curve_info **curve = NULL;
|
const mbedtls_ecp_curve_info **curve = NULL;
|
||||||
#if defined(MBEDTLS_ECP_C)
|
|
||||||
const mbedtls_ecp_group_id *gid;
|
const mbedtls_ecp_group_id *gid;
|
||||||
|
|
||||||
/* Match our preference list against the offered curves */
|
/* Match our preference list against the offered curves */
|
||||||
@ -2657,11 +2656,7 @@ static int ssl_write_server_key_exchange( mbedtls_ssl_context *ssl )
|
|||||||
goto curve_matching_done;
|
goto curve_matching_done;
|
||||||
|
|
||||||
curve_matching_done:
|
curve_matching_done:
|
||||||
#else
|
if( curve == NULL || *curve == NULL )
|
||||||
curve = ssl->handshake->curves;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( *curve == NULL )
|
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "no matching curve for ECDHE" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "no matching curve for ECDHE" ) );
|
||||||
return( MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN );
|
return( MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user