From 07aa2e420d253caa8a1ac38c5619955acbd6e63f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sat, 14 Sep 2019 15:58:17 -0400 Subject: [PATCH] sessiond: fix: possible unaligned access in packed structure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use a temporary relayd_session_id variable to prevent an unaligned access in the packed communication structure 'msg'. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/consumer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 53f7c3946..46ee31cc2 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -1151,9 +1151,10 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock, if (type == LTTNG_STREAM_CONTROL) { char output_path[LTTNG_PATH_MAX] = {}; + uint64_t relayd_session_id; ret = relayd_create_session(rsock, - &msg.u.relayd_sock.relayd_session_id, + &relayd_session_id, session_name, hostname, base_path, session_live_timer, consumer->snapshot, session_id, @@ -1166,6 +1167,7 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock, (void) relayd_close(rsock); goto error; } + msg.u.relayd_sock.relayd_session_id = relayd_session_id; DBG("Created session on relay, output path reply: %s", output_path); } -- 2.34.1