Skip to content

Commit

Permalink
[session] fix a session copy bug
Browse files Browse the repository at this point in the history
fix a possible double reference on 'ticket'
when peer_cert/peer_cert_digest calloc failed.

Signed-off-by: 吴敬辉 <[email protected]>
  • Loading branch information
吴敬辉 authored and davidhorstmann-arm committed Dec 7, 2021
1 parent dbfc651 commit 0f6c6bc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/ssl_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ int mbedtls_ssl_session_copy( mbedtls_ssl_session *dst,
mbedtls_ssl_session_free( dst );
memcpy( dst, src, sizeof( mbedtls_ssl_session ) );

#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
dst->ticket = NULL;
#endif

#if defined(MBEDTLS_X509_CRT_PARSE_C)

#if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
Expand Down

0 comments on commit 0f6c6bc

Please sign in to comment.