Check whether INT_MAX larger than SIZE_MAX scenario
Check whether INT_MAX larger than SIZE_MAX scenario
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index b3fb95c..4f7f992 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -2434,7 +2434,7 @@
if( ret < 0 )
return( ret );
- if ( (size_t)ret > len )
+ if ( (size_t)ret > len || ( INT_MAX > SIZE_MAX && ret > SIZE_MAX ) )
{
MBEDTLS_SSL_DEBUG_MSG( 1,
( "f_recv returned %d bytes but only %zu were requested",
@@ -2489,7 +2489,7 @@
if( ret <= 0 )
return( ret );
- if( (size_t)ret > ssl->out_left )
+ 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 %zu bytes were sent",