[gnutls-devel] [PATCH 2/2] If gnutls_record_send fails with GNUTLS_E_AGAIN or GNUTLS_E_INTERRUPTED, the documentation allows passing null for the data and size on retry.

Tim Kosse tim.kosse at filezilla-project.org
Fri May 10 19:49:38 CEST 2013


Commit 2ec84d6 broke this usage of gnutls_record_send. This patch fixes the problem.
---
 lib/gnutls_record.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c
index eea9372..ca9376e 100644
--- a/lib/gnutls_record.c
+++ b/lib/gnutls_record.c
@@ -500,9 +500,6 @@ _gnutls_send_tlen_int (gnutls_session_t session, content_type_t type,
   else
     send_data_size = data_size;
   
-  if (unlikely(send_data_size == 0))
-    return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR);
-
   /* Only encrypt if we don't have data to send 
    * from the previous run. - probably interrupted.
    */
@@ -518,6 +515,9 @@ _gnutls_send_tlen_int (gnutls_session_t session, content_type_t type,
     }
   else
     {
+      if (unlikely(send_data_size == 0))
+        return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR);
+
       /* now proceed to packet encryption
        */
       cipher_size = MAX_RECORD_SEND_SIZE(session);
-- 
1.7.2.5




More information about the Gnutls-devel mailing list