Better NULL checks in debug
In case we exit early, like before ssl_setup() was called
This commit is contained in:
parent
db1cc76091
commit
49f5eb9b41
@ -83,7 +83,7 @@ void mbedtls_debug_print_msg( const mbedtls_ssl_context *ssl, int level,
|
|||||||
char str[512];
|
char str[512];
|
||||||
int maxlen = sizeof( str ) - 1;
|
int maxlen = sizeof( str ) - 1;
|
||||||
|
|
||||||
if( ssl->conf->f_dbg == NULL || level > debug_threshold )
|
if( ssl->conf == NULL || ssl->conf->f_dbg == NULL || level > debug_threshold )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( debug_log_mode == MBEDTLS_DEBUG_LOG_RAW )
|
if( debug_log_mode == MBEDTLS_DEBUG_LOG_RAW )
|
||||||
@ -105,7 +105,7 @@ void mbedtls_debug_print_ret( const mbedtls_ssl_context *ssl, int level,
|
|||||||
int maxlen = sizeof( str ) - 1;
|
int maxlen = sizeof( str ) - 1;
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
|
|
||||||
if( ssl->conf->f_dbg == NULL || level > debug_threshold )
|
if( ssl->conf == NULL || ssl->conf->f_dbg == NULL || level > debug_threshold )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -134,7 +134,7 @@ void mbedtls_debug_print_buf( const mbedtls_ssl_context *ssl, int level,
|
|||||||
char txt[17];
|
char txt[17];
|
||||||
size_t i, maxlen = sizeof( str ) - 1, idx = 0;
|
size_t i, maxlen = sizeof( str ) - 1, idx = 0;
|
||||||
|
|
||||||
if( ssl->conf->f_dbg == NULL || level > debug_threshold )
|
if( ssl->conf == NULL || ssl->conf->f_dbg == NULL || level > debug_threshold )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( debug_log_mode == MBEDTLS_DEBUG_LOG_FULL )
|
if( debug_log_mode == MBEDTLS_DEBUG_LOG_FULL )
|
||||||
@ -195,7 +195,7 @@ void mbedtls_debug_print_ecp( const mbedtls_ssl_context *ssl, int level,
|
|||||||
char str[512];
|
char str[512];
|
||||||
int maxlen = sizeof( str ) - 1;
|
int maxlen = sizeof( str ) - 1;
|
||||||
|
|
||||||
if( ssl->conf->f_dbg == NULL || level > debug_threshold )
|
if( ssl->conf == NULL || ssl->conf->f_dbg == NULL || level > debug_threshold )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mbedtls_snprintf( str, maxlen, "%s(X)", text );
|
mbedtls_snprintf( str, maxlen, "%s(X)", text );
|
||||||
@ -217,7 +217,7 @@ void mbedtls_debug_print_mpi( const mbedtls_ssl_context *ssl, int level,
|
|||||||
int j, k, maxlen = sizeof( str ) - 1, zeros = 1;
|
int j, k, maxlen = sizeof( str ) - 1, zeros = 1;
|
||||||
size_t i, n, idx = 0;
|
size_t i, n, idx = 0;
|
||||||
|
|
||||||
if( ssl->conf->f_dbg == NULL || X == NULL || level > debug_threshold )
|
if( ssl->conf == NULL || ssl->conf->f_dbg == NULL || X == NULL || level > debug_threshold )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( n = X->n - 1; n > 0; n-- )
|
for( n = X->n - 1; n > 0; n-- )
|
||||||
@ -330,7 +330,7 @@ void mbedtls_debug_print_crt( const mbedtls_ssl_context *ssl, int level,
|
|||||||
char str[1024], prefix[64];
|
char str[1024], prefix[64];
|
||||||
int i = 0, maxlen = sizeof( prefix ) - 1, idx = 0;
|
int i = 0, maxlen = sizeof( prefix ) - 1, idx = 0;
|
||||||
|
|
||||||
if( ssl->conf->f_dbg == NULL || crt == NULL || level > debug_threshold )
|
if( ssl->conf == NULL || ssl->conf->f_dbg == NULL || crt == NULL || level > debug_threshold )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( debug_log_mode == MBEDTLS_DEBUG_LOG_FULL )
|
if( debug_log_mode == MBEDTLS_DEBUG_LOG_FULL )
|
||||||
|
Loading…
Reference in New Issue
Block a user