Fix compile error in ssl_pthread_server

This commit is contained in:
Manuel Pégourié-Gonnard 2014-07-12 01:27:34 +02:00
parent 8dcb2d7d7e
commit 955028f858
2 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,7 @@ PolarSSL ChangeLog (Sorted per branch, date)
= 1.3 branch = 1.3 branch
Bugfix Bugfix
* Support escaping of commas in x509_string_to_names() * Support escaping of commas in x509_string_to_names()
* Fix compile error in ssl_pthread_server (found by Julian Ospald).
= PolarSSL 1.3.8 released 2014-07-11 = PolarSSL 1.3.8 released 2014-07-11
Security Security

View File

@ -129,6 +129,10 @@ static void *handle_ssl_connection( void *data )
ssl_context ssl; ssl_context ssl;
ctr_drbg_context ctr_drbg; ctr_drbg_context ctr_drbg;
/* Make sure memory references are valid */
memset( &ssl, 0, sizeof( ssl_context ) );
memset( &ctr_drbg, 0, sizeof( ctr_drbg_context ) );
snprintf( pers, sizeof(pers), "SSL Pthread Thread %d", thread_id ); snprintf( pers, sizeof(pers), "SSL Pthread Thread %d", thread_id );
printf( " [ #%d ] Client FD %d\n", thread_id, client_fd ); printf( " [ #%d ] Client FD %d\n", thread_id, client_fd );
printf( " [ #%d ] Seeding the random number generator...\n", thread_id ); printf( " [ #%d ] Seeding the random number generator...\n", thread_id );
@ -176,7 +180,7 @@ static void *handle_ssl_connection( void *data )
if( ( ret = ssl_set_own_cert( &ssl, thread_info->server_cert, thread_info->server_key ) ) != 0 ) if( ( ret = ssl_set_own_cert( &ssl, thread_info->server_cert, thread_info->server_key ) ) != 0 )
{ {
printf( " failed\n ! ssl_set_own_cert returned %d\n\n", ret ); printf( " failed\n ! ssl_set_own_cert returned %d\n\n", ret );
goto exit; goto thread_exit;
} }
printf( " [ #%d ] ok\n", thread_id ); printf( " [ #%d ] ok\n", thread_id );
@ -308,6 +312,7 @@ thread_exit:
#endif #endif
net_close( client_fd ); net_close( client_fd );
ctr_drbg_free( &ctr_drbg );
ssl_free( &ssl ); ssl_free( &ssl );
thread_info->thread_complete = 1; thread_info->thread_complete = 1;
@ -492,7 +497,6 @@ exit:
#if defined(POLARSSL_SSL_CACHE_C) #if defined(POLARSSL_SSL_CACHE_C)
ssl_cache_free( &cache ); ssl_cache_free( &cache );
#endif #endif
ctr_drbg_free( &ctr_drbg );
entropy_free( &entropy ); entropy_free( &entropy );
polarssl_mutex_free( &debug_mutex ); polarssl_mutex_free( &debug_mutex );