From 098eda9873397b745a6fe645540ff4496bedf480 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 9 Jul 2015 12:20:22 +0200 Subject: [PATCH] Error checks for BIO_get_event ResetEvent before reading data from transport BIO. --- libfreerdp/core/transport.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index d037b5087..366ed54ad 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -674,7 +674,8 @@ DWORD transport_get_event_handles(rdpTransport* transport, HANDLE* events, DWORD { if (events && (nCount < count)) { - BIO_get_event(transport->frontBio, &events[nCount]); + if (BIO_get_event(transport->frontBio, &events[nCount]) != 1) + return 0; nCount++; } } @@ -749,7 +750,8 @@ int transport_check_fds(rdpTransport* transport) if (!transport) return -1; - BIO_get_event(transport->frontBio, &event); + if (BIO_get_event(transport->frontBio, &event) != 1) + return -1; /** * Loop through and read all available PDUs. Since multiple @@ -758,6 +760,7 @@ int transport_check_fds(rdpTransport* transport) * wait for a socket to get signaled that data is available * (which may never happen). */ + ResetEvent(event); for (;;) { /** @@ -773,8 +776,6 @@ int transport_check_fds(rdpTransport* transport) { if (status < 0) WLog_DBG(TAG, "transport_check_fds: transport_read_pdu() - %i", status); - - ResetEvent(event); return status; } @@ -803,7 +804,6 @@ int transport_check_fds(rdpTransport* transport) } } - ResetEvent(event); return 0; }