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

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

    [ https://issues.apache.org/jira/browse/GUACAMOLE-1517?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17481358#comment-17481358 ] 

Mike Jumper commented on GUACAMOLE-1517:
----------------------------------------

Yes, both points look correct.

That said, I'd just as soon recommend removing {{guac_socket_next()}} entirely. It's unused and has been deprecated for 2 years.

> 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
>            Priority: Trivial
>
> 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)