Uploaded image for project: 'Guacamole'
  1. Guacamole
  2. GUACAMOLE-23

__guac_socket_fd_select_handler() must always init fd_set

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.9.9
    • Fix Version/s: 0.9.10-incubating
    • Component/s: libguac
    • Labels:
      None

      Description

      The description of this issue was copied from GUAC-1477, an issue in the JIRA instance used by the Guacamole project prior to its acceptance into the Apache Incubator.

      Comments, attachments, related issues, and history from prior to acceptance have not been copied and can be found instead at the original issue.

      In socket_fd.c, in function __guac_socket_fd_select_handler(), select() will be invoked without initializing the corresponding fd_set if usec_timeout is less than zero:

          /* No timeout if usec_timeout is negative */
          if (usec_timeout < 0)
              retval = select(data->fd + 1, &fds, NULL, NULL, NULL); 
      
          /* Handle timeout if specified */
          else {
              timeout.tv_sec = usec_timeout/1000000;
              timeout.tv_usec = usec_timeout%1000000;
      
              FD_ZERO(&fds);
              FD_SET(data->fd, &fds);
      
              retval = select(data->fd + 1, &fds, NULL, NULL, &timeout);
          }
      

      Without the required FD_ZERO() and FD_SET() calls, select() will block indefinitely because no fd has been registered.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mike.jumper Michael Jumper
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: