From 09cfbe475dd1c509762e326c1063d0fe78065a2a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sat, 14 Sep 2019 16:09:35 -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 temporary control and data port variables to get rotation destination ports and explicitly copy them to the return communication structure. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/cmd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 14da88623..c17be934a 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -4995,6 +4995,9 @@ int cmd_rotate_get_info(struct ltt_session *session, } break; case CONSUMER_DST_NET: + { + uint16_t ctrl_port, data_port; + current_tracing_path_reply = info_return->location.relay.relative_path; current_tracing_path_reply_len = @@ -5013,9 +5016,9 @@ int cmd_rotate_get_info(struct ltt_session *session, goto end; } - session_get_net_consumer_ports(session, - &info_return->location.relay.ports.control, - &info_return->location.relay.ports.data); + session_get_net_consumer_ports(session, &ctrl_port, &data_port); + info_return->location.relay.ports.control = ctrl_port; + info_return->location.relay.ports.data = data_port; info_return->location_type = (int8_t) LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_RELAY; chunk_path = strdup(session->last_chunk_path); @@ -5026,6 +5029,7 @@ int cmd_rotate_get_info(struct ltt_session *session, goto end; } break; + } default: abort(); } -- 2.34.1