aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanos Follath <janos.follath@arm.com>2016-03-22 15:49:23 +0000
committerJanos Follath <janos.follath@arm.com>2016-03-22 15:49:23 +0000
commit3f81973a9aa83f8d0c59960e0403f5fff7faf33d (patch)
tree4a6495580448f94ca6fa0221acd66f3bd45cef24
parent4dfecabb977ebf24d3cff66e43bc96aa21d2c077 (diff)
downloadmbedtls-archive/iotssl-580-invalid-curves-crash-1.3.zip
mbedtls-archive/iotssl-580-invalid-curves-crash-1.3.tar.gz
mbedtls-archive/iotssl-580-invalid-curves-crash-1.3.tar.bz2
Fix bug in ssl_write_supported_elliptic_curves_extarchive/iotssl-580-invalid-curves-crash-1.3
Passing invalid curves to mbedtls_ssl_conf_curves caused a crash later in ssl_write_supported_elliptic_curves_ext. #373
-rw-r--r--ChangeLog2
-rw-r--r--library/ssl_cli.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f3e6d1d..20d623a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@ Bugfix
arguments where the same (in-place doubling). Found and fixed by Janos
Follath. #309
* 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
* On ARM platforms, when compiling with -O0 with GCC, Clang or armcc5,
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
index b1cd7cb..e1cebbf 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -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++ )
{
#endif
+ if( info == NULL )
+ {
+ SSL_DEBUG_MSG( 1, ( "invalid curve in ssl configuration" ) );
+ return;
+ }
+
elliptic_curve_len += 2;
}