You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@guacamole.apache.org by "Andreas Vögele (Jira)" <ji...@apache.org> on 2022/01/24 19:46:00 UTC

[jira] [Created] (GUACAMOLE-1517) data->written is not initialized in guac_socket_nest()

Andreas Vögele created GUACAMOLE-1517:
-----------------------------------------

             Summary: data->written is not initialized in guac_socket_nest()
                 Key: GUACAMOLE-1517
                 URL: https://issues.apache.org/jira/browse/GUACAMOLE-1517
             Project: Guacamole
          Issue Type: Bug
          Components: libguac
            Reporter: Andreas Vögele


data->written needs to be set to 0 in guac_socket_nest() in src/libguac/socket-nest.c. Alternatively the "data" structure could be allocated with calloc() instead of malloc().
The tests may fail and produce a core dump if data->written is not initialized.
{code:java}
    /* Store nested socket details as socket data */
    data->parent = parent;
    data->index = index;
    data->written = 0; // <----
    socket->data = data;{code}
There's also the following code in src/libguac/tests/socket/nested_send_instruction.c:

 
{code:java}
    guac_socket* nested_socket = guac_socket_nest(socket, 123);
    /* Write nothing if nested socket cannot be allocated (test will fail in
     * parent process due to failure to read) */
    if (socket == NULL) {
        guac_socket_free(socket);
        return;
    }
{code}
Shouldn't the if-condition check nested_socket?
{code:java}
if (nested_socket == NULL){code}
 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)