mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
mbedtls: Prevent arithmetic overflow on bounds check
Part of the patch for CVE-2018-9988.
Cherry-pick of 027f84c69f
Ref. https://github.com/espressif/esp-idf/issues/1860
This commit is contained in:
@@ -2473,7 +2473,7 @@ static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl )
|
||||
sig_len = ( p[0] << 8 ) | p[1];
|
||||
p += 2;
|
||||
|
||||
if( end != p + sig_len )
|
||||
if( p != end - sig_len )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||
|
Reference in New Issue
Block a user