Merge remote-tracking branch 'upstream-public/pr/1396' into mbedtls-2.1-proposed

This commit is contained in:
Jaeden Amero 2018-04-03 12:07:19 +01:00
commit ee6c822076
2 changed files with 19 additions and 0 deletions

View file

@ -43,6 +43,9 @@ Changes
Alex Hixon.
* Allow configuring the shared library extension by setting the DLEXT
environment variable when using the project makefiles.
* Verify that when (f_send, f_recv and f_recv_timeout) send or receive
more than the required length an error is returned. Raised by
Sam O'Connor in #1245.
= mbed TLS 2.1.11 branch released 2018-03-16

View file

@ -2413,6 +2413,14 @@ int mbedtls_ssl_fetch_input( mbedtls_ssl_context *ssl, size_t nb_want )
if( ret < 0 )
return( ret );
if ( (size_t)ret > len || ( INT_MAX > SIZE_MAX && ret > SIZE_MAX ) )
{
MBEDTLS_SSL_DEBUG_MSG( 1,
( "f_recv returned %d bytes but only %lu were requested",
ret, (unsigned long)len ) );
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
ssl->in_left += ret;
}
}
@ -2460,6 +2468,14 @@ int mbedtls_ssl_flush_output( mbedtls_ssl_context *ssl )
if( ret <= 0 )
return( ret );
if( (size_t)ret > ssl->out_left || ( INT_MAX > SIZE_MAX && ret > SIZE_MAX ) )
{
MBEDTLS_SSL_DEBUG_MSG( 1,
( "f_send returned %d bytes but only %lu bytes were sent",
ret, (unsigned long)ssl->out_left ) );
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
ssl->out_left -= ret;
}