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: 吴敬辉 <11137405@vivo.com>
  • Loading branch information
吴敬辉 authored and davidhorstmann-arm committed Dec 8, 2021
1 parent 286bd24 commit eb490aa
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 @@ -301,6 +301,10 @@ static int ssl_session_copy( mbedtls_ssl_session *dst, const mbedtls_ssl_session
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( src->peer_cert != NULL )
{
Expand Down

0 comments on commit eb490aa

Please sign in to comment.