Skip to content

Commit b72aef2

Browse files
Fix undefined behavior in mbedTLS transport log format specifiers (FreeRTOS#1406)
* Fix undefined behavior in mbedTLS transport log statements * pNetworkContext now explicitly cast to void pointer * Delete personal fil
1 parent e6af9f2 commit b72aef2

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

FreeRTOS-Plus/Source/Application-Protocols/network_transport/transport_mbedtls.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ static TlsTransportStatus_t initMbedtls( mbedtls_entropy_context * pEntropyConte
659659

660660
if( mbedtlsError != PSA_SUCCESS )
661661
{
662-
LogError( ( "Failed to initialize PSA Crypto implementation: %s", ( int ) mbedtlsError ) );
662+
LogError( ( "Failed to initialize PSA Crypto implementation: %d", ( int ) mbedtlsError ) );
663663
returnStatus = TLS_TRANSPORT_INTERNAL_ERROR;
664664
}
665665
}
@@ -832,8 +832,8 @@ void TLS_FreeRTOS_Disconnect( NetworkContext_t * pNetworkContext )
832832
/* WANT_READ and WANT_WRITE can be ignored. Logging for debugging purposes. */
833833
LogInfo( ( "(Network connection %p) TLS close-notify sent; "
834834
"received %s as the TLS status can be ignored for close-notify.",
835-
( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) ? "WANT_READ" : "WANT_WRITE",
836-
pNetworkContext ) );
835+
( void * ) pNetworkContext,
836+
( tlsStatus == MBEDTLS_ERR_SSL_WANT_READ ) ? "WANT_READ" : "WANT_WRITE" ) );
837837
}
838838

839839
/* Call socket shutdown function to close connection. */

FreeRTOS-Plus/Source/Application-Protocols/network_transport/transport_mbedtls_pkcs11.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext,
320320

321321
if( mbedtlsError != PSA_SUCCESS )
322322
{
323-
LogError( ( "Failed to initialize PSA Crypto implementation: %s", ( int ) mbedtlsError ) );
323+
LogError( ( "Failed to initialize PSA Crypto implementation: %d", ( int ) mbedtlsError ) );
324324
returnStatus = TLS_TRANSPORT_INVALID_PARAMETER;
325325
}
326326
else

0 commit comments

Comments
 (0)