From 1fd00bfe82af7c52f3d0d042cbd97e554d84b9ad Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Mon, 14 Mar 2011 20:50:15 +0000 Subject: [PATCH] - Fixed bug in ssl_write() when flushing old data (Fixes ticket #18) --- ChangeLog | 2 ++ library/ssl_tls.c | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4161a2faf..6e2c063c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ Bugfix * Debug output of MPI's now the same independent of underlying platform (32-bit / 64-bit) (Fixes ticket #19, found by Mads Kiilerich and Mihai Militaru) + * Fixed bug in ssl_write() when flushing old data (Fixed ticket + #18, found by Nikolay Epifanov) = Version 0.99-pre3 released on 2011-02-28 This release replaces version 0.99-pre2 which had possible copyright issues. diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 27c456acf..ea374eda3 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -2141,9 +2141,6 @@ int ssl_write( ssl_context *ssl, const unsigned char *buf, int len ) } } - n = ( len < SSL_MAX_CONTENT_LEN ) - ? len : SSL_MAX_CONTENT_LEN; - if( ssl->out_left != 0 ) { if( ( ret = ssl_flush_output( ssl ) ) != 0 ) @@ -2152,17 +2149,18 @@ int ssl_write( ssl_context *ssl, const unsigned char *buf, int len ) return( ret ); } } - else - { - ssl->out_msglen = n; - ssl->out_msgtype = SSL_MSG_APPLICATION_DATA; - memcpy( ssl->out_msg, buf, n ); - if( ( ret = ssl_write_record( ssl ) ) != 0 ) - { - SSL_DEBUG_RET( 1, "ssl_write_record", ret ); - return( ret ); - } + n = ( len < SSL_MAX_CONTENT_LEN ) + ? len : SSL_MAX_CONTENT_LEN; + + ssl->out_msglen = n; + ssl->out_msgtype = SSL_MSG_APPLICATION_DATA; + memcpy( ssl->out_msg, buf, n ); + + if( ( ret = ssl_write_record( ssl ) ) != 0 ) + { + SSL_DEBUG_RET( 1, "ssl_write_record", ret ); + return( ret ); } SSL_DEBUG_MSG( 2, ( "<= write" ) );