diff options
author | George Fleury <gfleury@gmail.com> | 2016-05-13 06:01:43 -0300 |
---|---|---|
committer | George Fleury <gfleury@gmail.com> | 2016-05-13 06:01:43 -0300 |
commit | 1417cb1c3f19de906074983bd98caee5283cb006 (patch) | |
tree | c3864da3a94be18876c0f655df5ed3fda1f070b7 | |
parent | 785f0fa2d1fe18f08bf521ed4a0d34a5d0c87782 (diff) | |
download | libtdevnc-1417cb1c3f19de906074983bd98caee5283cb006.tar.gz libtdevnc-1417cb1c3f19de906074983bd98caee5283cb006.zip |
Avoid calling SSL_pending when connection is already closed
Avoid calling SSL_pending when connection is already closed, calling SSL_pending with connection already closed is crashing.
To reproduce, open a secure websocket binay protocol connection with libvncserver compiled with OpenSSL, and when libvncserver is waiting for rfbProcessClientProtocolVersion send any invalid char, it will fail and call rfbCloseClient whith destroy all SSL context, calling SSL_pending after that will generate a invalid access.
-rw-r--r-- | libvncserver/sockets.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c index e960936..51e86eb 100644 --- a/libvncserver/sockets.c +++ b/libvncserver/sockets.c @@ -394,7 +394,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec) #ifdef LIBVNCSERVER_WITH_WEBSOCKETS do { rfbProcessClientMessage(cl); - } while (webSocketsHasDataInBuffer(cl)); + } while (cl->sock > 0 && webSocketsHasDataInBuffer(cl)); #else rfbProcessClientMessage(cl); #endif |