Skip to content

Commit

Permalink
libvncserver: check for invalid socket before FD_ISSET in httpd
Browse files Browse the repository at this point in the history
A mere workaround/mitigation for when the socket is closed by another thread...
  • Loading branch information
bk138 committed Aug 30, 2024
1 parent 06cff31 commit 27617e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libvncserver/httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
httpProcessInput(rfbScreen);
}

if (FD_ISSET(rfbScreen->httpListenSock, &fds) || FD_ISSET(rfbScreen->httpListen6Sock, &fds)) {
if ((rfbScreen->httpListenSock != RFB_INVALID_SOCKET && FD_ISSET(rfbScreen->httpListenSock, &fds))
|| (rfbScreen->httpListen6Sock != RFB_INVALID_SOCKET && FD_ISSET(rfbScreen->httpListen6Sock, &fds))) {
if (rfbScreen->httpSock != RFB_INVALID_SOCKET) rfbCloseSocket(rfbScreen->httpSock);

if(FD_ISSET(rfbScreen->httpListenSock, &fds)) {
Expand Down

0 comments on commit 27617e1

Please sign in to comment.