libfreerdp/core: transport_write unchecked parameters
authorMartin Haimberger <martin.haimberger@thincast.com>
Mon, 22 Aug 2016 09:17:11 +0000 (02:17 -0700)
committerMartin Haimberger <martin.haimberger@thincast.com>
Mon, 22 Aug 2016 09:17:11 +0000 (02:17 -0700)
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

index 26563e7..2ae619a 100644 (file)
@@ -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);