From e9e0764acef96c7c8bba14a0252c497da3f54af0 Mon Sep 17 00:00:00 2001 From: Martin Haimberger Date: Mon, 22 Aug 2016 02:17:11 -0700 Subject: [PATCH] libfreerdp/core: transport_write unchecked parameters transport_write did not check if transport or bio are set. The transport read checks it. In using fastpath and for example a mouse input is sent, the transport is never checked and can cause a segfault. --- libfreerdp/core/transport.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index 26563e779..2ae619add 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -657,6 +657,15 @@ int transport_write(rdpTransport* transport, wStream* s) int status = -1; int writtenlength = 0; + if (!transport) + return -1; + + if (!transport->frontBio) + { + transport->layer = TRANSPORT_LAYER_CLOSED; + return -1; + } + EnterCriticalSection(&(transport->WriteLock)); length = Stream_GetPosition(s);