diff options
author | makise-homura <akemi_homura@kurisa.ch> | 2020-08-24 18:26:27 +0300 |
---|---|---|
committer | makise-homura <akemi_homura@kurisa.ch> | 2020-08-24 23:42:49 +0300 |
commit | af9513bb48407544c301fe2a06b69793c38e7a8a (patch) | |
tree | 5e9bd76a0f23ca9942288cecb426637800ff6d15 | |
parent | e014fece509a5c486c685f384e1286fba2653ab7 (diff) | |
download | mbed-tls-af9513bb48407544c301fe2a06b69793c38e7a8a.tar.gz |
A different approach of signed-to-unsigned comparison
Suggsted by @hanno-arm
Signed-off-by: makise-homura <akemi_homura@kurisa.ch>
-rw-r--r-- | library/ssl_msg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/ssl_msg.c b/library/ssl_msg.c index 259a71d2f..0d74e6d82 100644 --- a/library/ssl_msg.c +++ b/library/ssl_msg.c @@ -2048,7 +2048,7 @@ 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 && (size_t)ret > SIZE_MAX ) ) + if ( (size_t)ret > len || ( INT_MAX > SIZE_MAX && ret > (int)SIZE_MAX ) ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "f_recv returned %d bytes but only %lu were requested", @@ -2102,7 +2102,7 @@ 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 && (size_t)ret > SIZE_MAX ) ) + if( (size_t)ret > ssl->out_left || ( INT_MAX > SIZE_MAX && ret > (int)SIZE_MAX ) ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "f_send returned %d bytes but only %lu bytes were sent", |