mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-04 19:09:48 +00:00
Merge pull request #863 from davidhorstmann-arm/2.x-fix-session-copy-bug
Backport 2.x: [session] fix a session copy bug
This commit is contained in:
commit
9ac32eb123
6
ChangeLog.d/fix-session-copy-bug.txt
Normal file
6
ChangeLog.d/fix-session-copy-bug.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Bugfix
|
||||||
|
* Fix a double-free that happened after mbedtls_ssl_set_session() or
|
||||||
|
mbedtls_ssl_get_session() failed with MBEDTLS_ERR_SSL_ALLOC_FAILED
|
||||||
|
(out of memory). After that, calling mbedtls_ssl_session_free()
|
||||||
|
and mbedtls_ssl_free() would cause an internal session buffer to
|
||||||
|
be free()'d twice.
|
|
@ -188,6 +188,10 @@ int mbedtls_ssl_session_copy( mbedtls_ssl_session *dst,
|
||||||
mbedtls_ssl_session_free( dst );
|
mbedtls_ssl_session_free( dst );
|
||||||
memcpy( dst, src, sizeof( mbedtls_ssl_session ) );
|
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_X509_CRT_PARSE_C)
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
|
#if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
|
||||||
|
|
Loading…
Reference in a new issue