Fixed potential memory leak when failing to resume a session

Conflicts:
	ChangeLog
	library/ssl_tls.c
This commit is contained in:
Paul Bakker 2013-09-11 11:45:41 +02:00
parent 16e5f81473
commit df177ba728
2 changed files with 10 additions and 0 deletions

View file

@ -1,6 +1,9 @@
PolarSSL ChangeLog
= Branch 1.1
Bugfix
* Fixed potential memory leak when failing to resume a session
Security
* Potential buffer-overflow for ssl_read_record() (independently found by
both TrustInSoft and Paul Brodeur of Leviathan Security Group)

View file

@ -1444,6 +1444,13 @@ int ssl_parse_certificate( ssl_context *ssl )
return( POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE );
}
/* In case we tried to reuse a session but it failed */
if( ssl->peer_cert != NULL )
{
x509_free( ssl->peer_cert );
free( ssl->peer_cert );
}
if( ( ssl->peer_cert = (x509_cert *) malloc(
sizeof( x509_cert ) ) ) == NULL )
{