Fix: inbound buffer may be set too short on partial command reception
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-events.c
index 66223e9d340e89f8c39b8dc3b5b5bfbecbbf096a..0fd97e4e2f1e95172f4c4cb2883d2dd627d18b95 100644 (file)
@@ -1509,7 +1509,7 @@ int client_dispatch_message(struct notification_client *client,
                handshake_client =
                                (struct lttng_notification_channel_command_handshake *)
                                        client->communication.inbound.buffer.data;
-                               client->major = handshake_client->major;
+               client->major = handshake_client->major;
                client->minor = handshake_client->minor;
                if (!client->communication.inbound.creds_received) {
                        ERR("[notification-thread] No credentials received from client");
@@ -1622,9 +1622,14 @@ int handle_notification_thread_client_in(
        }
 
        offset = client->communication.inbound.buffer.size;
+       /*
+        * The buffer's size starts out at the size of the command header.
+        * Once the command is determined, the "bytes_to_receive" are bumped
+        * to fit the remainder of the message being received.
+        */
        ret = lttng_dynamic_buffer_set_size(
                        &client->communication.inbound.buffer,
-                       client->communication.inbound.bytes_to_receive);
+                       client->communication.inbound.bytes_to_receive + offset);
        if (ret) {
                goto end;
        }
This page took 0.024222 seconds and 5 git commands to generate.