- Fixed bug in ssl_write() when flushing old data (Fixes ticket #18)
diff --git a/ChangeLog b/ChangeLog
index 4161a2f..6e2c063 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,8 @@
* 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 27c456a..ea374ed 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -2141,9 +2141,6 @@
}
}
- 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 @@
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" ) );