Skip to content

Commit e7ee07d

Browse files
committed
common: don't give invalid fd to FD_SET
re #655
1 parent 4d4c4fe commit e7ee07d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/common/sockets.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ rfbBool sock_wait_for_connected(int socket, unsigned int timeout_seconds)
6060
timeout.tv_sec=timeout_seconds;
6161
timeout.tv_usec=0;
6262

63+
if(socket == RFB_INVALID_SOCKET) {
64+
errno = EBADF;
65+
return FALSE;
66+
}
67+
6368
FD_ZERO(&writefds);
6469
FD_SET(socket, &writefds);
6570
FD_ZERO(&exceptfds);

0 commit comments

Comments
 (0)