Skip to content

Commit dacc738

Browse files
committed
thirdparty: improve -cstrict -cc clang-18 -prod compatibility for programs that do import net.mbedtls
1 parent e129ec5 commit dacc738

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

thirdparty/mbedtls/library/pk.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ int mbedtls_pk_sign_restartable( mbedtls_pk_context *ctx,
576576
if( ( md_alg != MBEDTLS_MD_NONE || hash_len != 0 ) && hash == NULL )
577577
return MBEDTLS_ERR_PK_BAD_INPUT_DATA;
578578

579+
if( ctx == NULL ) return MBEDTLS_ERR_PK_BAD_INPUT_DATA;
579580
if( ctx->pk_info == NULL || pk_hashlen_helper( md_alg, &hash_len ) != 0 )
580581
return( MBEDTLS_ERR_PK_BAD_INPUT_DATA );
581582

thirdparty/mbedtls/library/ssl_misc.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,26 +1582,30 @@ static inline mbedtls_ssl_srtp_profile mbedtls_ssl_check_srtp_profile_value
15821582
#if defined(MBEDTLS_X509_CRT_PARSE_C)
15831583
static inline mbedtls_pk_context *mbedtls_ssl_own_key( mbedtls_ssl_context *ssl )
15841584
{
1585+
if( NULL == ssl) return NULL;
15851586
mbedtls_ssl_key_cert *key_cert;
1586-
1587-
if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL )
1587+
if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL ) {
15881588
key_cert = ssl->handshake->key_cert;
1589-
else
1589+
} else {
1590+
if( NULL == ssl->conf ) return NULL;
15901591
key_cert = ssl->conf->key_cert;
1591-
1592-
return( key_cert == NULL ? NULL : key_cert->key );
1592+
}
1593+
if( NULL == key_cert) return NULL;
1594+
return key_cert->key;
15931595
}
15941596

15951597
static inline mbedtls_x509_crt *mbedtls_ssl_own_cert( mbedtls_ssl_context *ssl )
15961598
{
1599+
if( NULL == ssl) return NULL;
15971600
mbedtls_ssl_key_cert *key_cert;
1598-
1599-
if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL )
1601+
if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL ) {
16001602
key_cert = ssl->handshake->key_cert;
1601-
else
1603+
} else {
1604+
if( NULL == ssl->conf ) return NULL;
16021605
key_cert = ssl->conf->key_cert;
1603-
1604-
return( key_cert == NULL ? NULL : key_cert->cert );
1606+
}
1607+
if( NULL == key_cert) return NULL;
1608+
return key_cert->cert;
16051609
}
16061610

16071611
/*

thirdparty/mbedtls/library/ssl_tls.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3774,9 +3774,8 @@ int mbedtls_ssl_handshake( mbedtls_ssl_context *ssl )
37743774

37753775
/* Sanity checks */
37763776

3777-
if( ssl == NULL || ssl->conf == NULL )
3778-
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
3779-
3777+
if( NULL == ssl ) return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
3778+
if( NULL == ssl->conf ) return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
37803779
#if defined(MBEDTLS_SSL_PROTO_DTLS)
37813780
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
37823781
( ssl->f_set_timer == NULL || ssl->f_get_timer == NULL ) )

thirdparty/zip/miniz.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5131,8 +5131,7 @@ static int mz_mkdir(const char *pDirname) {
51315131
#define MZ_MKDIR(d) mkdir(d, 0755)
51325132

51335133
#else
5134-
#pragma message( \
5135-
"Using fopen, ftello, fseeko, stat() etc. path for file I/O - this path may not support large files.")
5134+
#pragma message("Using fopen, ftello, fseeko, stat() etc. path for file I/O - this path may not support large files.")
51365135
#ifndef MINIZ_NO_TIME
51375136
#include <utime.h>
51385137
#endif

0 commit comments

Comments
 (0)