From f811ee34f035e1cd7c205e4e774ebfff68fbabf8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sat, 27 May 2017 06:17:48 -0400 Subject: [PATCH] Fix: inbound buffer may be set too short on partial command reception MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/notification-thread-events.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index 0bb75b6d8..0fd97e4e2 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -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; } -- 2.34.1