From ec603701ef51f85beef83898aa36e385028692f1 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 11 Aug 2011 10:31:25 +0200 Subject: [PATCH] SSL: Handle EOF case in ssl_get If gnutls was in use and gnutls_record_recv returned 0 (EOF) the ssl_get function would never terminate. --- src/tcpip.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tcpip.c b/src/tcpip.c index b9466d6..c3a4b05 100644 --- a/src/tcpip.c +++ b/src/tcpip.c @@ -1159,7 +1159,12 @@ int ssl_get(COMSTACK h, char **buf, int *bufsize) #if HAVE_GNUTLS_H res = gnutls_record_recv(sp->session, *buf + hasread, CS_TCPIP_BUFCHUNK); - if (res < 0) + if (res == 0) + { + TRC(fprintf(stderr, "gnutls_record_recv returned 0\n")); + return 0; + } + else if (res < 0) { if (ssl_check_error(h, sp, res)) break; -- 1.7.10.4