mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Add guard to out_left to avoid negative values
return error when f_send return a value greater than out_left
This commit is contained in:
@ -2469,6 +2469,12 @@ int mbedtls_ssl_flush_output( mbedtls_ssl_context *ssl )
|
||||
if( ret <= 0 )
|
||||
return( ret );
|
||||
|
||||
if( (size_t)ret > ssl->out_left )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "f_send returned value greater than out left size" ) );
|
||||
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
|
||||
}
|
||||
|
||||
ssl->out_left -= ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user