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

data->written is not initialized in guac_socket_nest()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Won't Fix
    • None
    • None
    • libguac
    • None

    Description

      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.

          /* Store nested socket details as socket data */
          data->parent = parent;
          data->index = index;
          data->written = 0; // <----
          socket->data = data;

      There's also the following code in src/libguac/tests/socket/nested_send_instruction.c:

          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;
          }
      

      Shouldn't the if-condition check nested_socket?

      if (nested_socket == NULL)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              voegelas Andreas Vögele
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: