summaryrefslogtreecommitdiffstats
path: root/libvncserver
diff options
context:
space:
mode:
authorKyle J. McKay <mackyle@gmail.com>2012-05-18 00:30:11 -0700
committerChristian Beier <dontmind@freeshell.org>2012-05-21 14:46:19 +0200
commit66282f58000c8863e104666c30cb67b1d5cbdee3 (patch)
tree3238c4c1576cb9c23408dd1b0423ea37bbee2012 /libvncserver
parent2a97ab8679157c629e67b966d16ee86a0b6c2d90 (diff)
downloadlibtdevnc-66282f58000c8863e104666c30cb67b1d5cbdee3.tar.gz
libtdevnc-66282f58000c8863e104666c30cb67b1d5cbdee3.zip
libvncserver/sockets.c: do not segfault when listenSock/listen6Sock == -1
Diffstat (limited to 'libvncserver')
-rw-r--r--libvncserver/sockets.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c
index 84c9c98..3ff2aac 100644
--- a/libvncserver/sockets.c
+++ b/libvncserver/sockets.c
@@ -402,9 +402,9 @@ rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
rfbLogPerror("rfbProcessNewConnection: error in select");
return FALSE;
}
- if (FD_ISSET(rfbScreen->listenSock, &listen_fds))
+ if (rfbScreen->listenSock >= 0 && FD_ISSET(rfbScreen->listenSock, &listen_fds))
chosen_listen_sock = rfbScreen->listenSock;
- if (FD_ISSET(rfbScreen->listen6Sock, &listen_fds))
+ if (rfbScreen->listen6Sock >= 0 && FD_ISSET(rfbScreen->listen6Sock, &listen_fds))
chosen_listen_sock = rfbScreen->listen6Sock;
if ((sock = accept(chosen_listen_sock,