Uploaded image for project: 'Apache Guacamole - Contributions'
  1. Apache Guacamole - Contributions
  2. GUAC-1477

__guac_socket_fd_select_handler() must always init fd_set

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.9.9
    • Fix Version/s: 0.9.10-incubating
    • Component/s: libguac
    • Labels:
      None
    • Sprint:
      DEV 2016-02-12
    • Story Points:
      2

      Description

      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:

      95
          /* No timeout if usec_timeout is negative */
      96
          if (usec_timeout < 0)
      97
              retval = select(data->fd + 1, &fds, NULL, NULL, NULL); 
      98
       
      99
          /* Handle timeout if specified */
      100
          else {
      101
              timeout.tv_sec = usec_timeout/1000000;
      102
              timeout.tv_usec = usec_timeout%1000000;
      103
       
      104
              FD_ZERO(&fds);
      105
              FD_SET(data->fd, &fds);
      106
       
      107
              retval = select(data->fd + 1, &fds, NULL, NULL, &timeout);
      108
          }

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

        Attachments

          Activity

            People

            • Assignee:
              mike.jumper Michael Jumper
              Reporter:
              T.C Tang Cheng
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: