Ticket #34519: patch-libvncserver-0.9.9-no-segfault.diff

File patch-libvncserver-0.9.9-no-segfault.diff, 712 bytes (added by mackyle@…, 12 years ago)

files/patch-libvncserver-0.9.9-no-segfault.diff patch file

  • libvncserver/sockets.c

    diff -Nuradp libvncserver/sockets.c libvncserver/sockets.c
    rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen) 
    402402      rfbLogPerror("rfbProcessNewConnection: error in select");
    403403      return FALSE;
    404404    }
    405     if (FD_ISSET(rfbScreen->listenSock, &listen_fds))
     405    if (rfbScreen->listenSock >= 0 && FD_ISSET(rfbScreen->listenSock, &listen_fds))
    406406      chosen_listen_sock = rfbScreen->listenSock;
    407     if (FD_ISSET(rfbScreen->listen6Sock, &listen_fds))
     407    if (rfbScreen->listen6Sock >= 0 && FD_ISSET(rfbScreen->listen6Sock, &listen_fds))
    408408      chosen_listen_sock = rfbScreen->listen6Sock;
    409409
    410410    if ((sock = accept(chosen_listen_sock,