You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by "Michael Jumper (JIRA)" <ji...@apache.org> on 2016/05/19 06:03:12 UTC

[jira] [Created] (GUACAMOLE-23) __guac_socket_fd_select_handler() must always init fd_set

Michael Jumper created GUACAMOLE-23:
---------------------------------------

             Summary: __guac_socket_fd_select_handler() must always init fd_set
                 Key: GUACAMOLE-23
                 URL: https://issues.apache.org/jira/browse/GUACAMOLE-23
             Project: Guacamole
          Issue Type: Bug
          Components: libguac
    Affects Versions: 0.9.9
            Reporter: Michael Jumper
            Priority: Minor
             Fix For: 0.9.10-incubating


{panel:bgColor=#FFFFEE}
*The description of this issue was copied from [GUAC-1477|https://glyptodon.org/jira/browse/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.
{panel}

In [socket_fd.c|https://github.com/glyptodon/guacamole-server/blob/f49540f43644108fb50876c6cd208274688ce3e2/src/libguac/socket-fd.c#L95-L108], in function {{__guac_socket_fd_select_handler()}}, {{select()}} will be invoked without initializing the corresponding {{fd_set}} if {{usec_timeout}} is less than zero:

{code:none}
    /* 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);
    }
{code}

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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)