Fix bug in ssl_write_supported_elliptic_curves_ext

Passing invalid curves to mbedtls_ssl_conf_curves caused a crash later
in ssl_write_supported_elliptic_curves_ext. #373
This commit is contained in:
Janos Follath 2016-03-22 15:49:23 +00:00
parent 4dfecabb97
commit 3f81973a9a
2 changed files with 8 additions and 0 deletions

View file

@ -7,6 +7,8 @@ Bugfix
arguments where the same (in-place doubling). Found and fixed by Janos arguments where the same (in-place doubling). Found and fixed by Janos
Follath. #309 Follath. #309
* Fix issue in Makefile that prevented building using armar. #386 * Fix issue in Makefile that prevented building using armar. #386
* Fix issue that caused a crash if invalid curves were passed to
mbedtls_ssl_conf_curves. #373
Changes Changes
* On ARM platforms, when compiling with -O0 with GCC, Clang or armcc5, * On ARM platforms, when compiling with -O0 with GCC, Clang or armcc5,

View file

@ -330,6 +330,12 @@ static void ssl_write_supported_elliptic_curves_ext( ssl_context *ssl,
for( info = ecp_curve_list(); info->grp_id != POLARSSL_ECP_DP_NONE; info++ ) for( info = ecp_curve_list(); info->grp_id != POLARSSL_ECP_DP_NONE; info++ )
{ {
#endif #endif
if( info == NULL )
{
SSL_DEBUG_MSG( 1, ( "invalid curve in ssl configuration" ) );
return;
}
elliptic_curve_len += 2; elliptic_curve_len += 2;
} }