]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6683: [mod_dingaling] iksemel TLS-Fragments #resolve
authorBrian West <brian@freeswitch.org>
Fri, 3 Feb 2017 23:29:46 +0000 (17:29 -0600)
committerBrian West <brian@freeswitch.org>
Fri, 3 Feb 2017 23:29:46 +0000 (17:29 -0600)
libs/iksemel/src/stream.c

index eda6cb0fe70876cf912ebabe697df9561bdaa0ba..a35f29223ae27550ea55b6595ed9cd6db7a0caec 100644 (file)
@@ -785,7 +785,9 @@ iks_recv (iksparser *prs, int timeout)
 #ifdef HAVE_GNUTLS
                if (data->flags & SF_SECURE) {
                        len = gnutls_record_recv (data->sess, data->buf, NET_IO_BUF_SIZE - 1);
-                       if (len == 0) len = -1;
+                       if (len > 0 && len < 5) {
+                               len += gnutls_record_recv (data->sess, data->buf + len, NET_IO_BUF_SIZE - 1 - len);
+                       } else if (len == 0) len = -1;
                } else
 #elif HAVE_SSL
                if (data->flags & SF_SECURE) {
@@ -797,6 +799,9 @@ iks_recv (iksparser *prs, int timeout)
                                return IKS_OK;
                        } else {
                                len = SSL_read(data->ssl, data->buf, NET_IO_BUF_SIZE - 1);
+                               if (len > 0 && len < 5) {
+                                       len += SSL_read(data->ssl, data->buf + len, NET_IO_BUF_SIZE - 1 - len);
+                               }
                        }
                        
                        if( len <= 0 )