From b41732ada728a238b90f20f4fca6ddf89550b1aa Mon Sep 17 00:00:00 2001 From: Luis Angel Curiel Sanz Date: Fri, 19 Apr 2013 08:39:59 +0200 Subject: [PATCH] Fixed bug on sock_read. It returns 0 when an error reading occurs, and this situation was not being controlled. --- src/tls_schannel.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tls_schannel.c b/src/tls_schannel.c index c1db394..0c49350 100644 --- a/src/tls_schannel.c +++ b/src/tls_schannel.c @@ -454,6 +454,12 @@ int tls_read(tls_t *tls, void * const buff, const size_t len) /* next, top up our recv buffer */ bytes = sock_read(tls->sock, tls->recvbuffer + tls->recvbufferpos, tls->recvbuffermaxlen - tls->recvbufferpos); + + if (bytes == 0) + { + tls->lasterror = WSAETIMEDOUT; + return -1; + } if (bytes == -1) { if (!tls_is_recoverable(sock_error())) {