From a914e76ac1a529191035f1fec439026c83beee3f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sat, 14 Sep 2019 16:16:56 -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 snapshot_id in cmd_rotate_get_info() to obtain the return value of cmd_snapshot_add_output() and explicitly assign it to the reply communication structure. Otherwise, &reply.id may be unaligned. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/client.c b/src/bin/lttng-sessiond/client.c index 7b7642ea7..fa7672b58 100644 --- a/src/bin/lttng-sessiond/client.c +++ b/src/bin/lttng-sessiond/client.c @@ -1712,13 +1712,15 @@ error_add_context: } case LTTNG_SNAPSHOT_ADD_OUTPUT: { + uint32_t snapshot_id; struct lttcomm_lttng_output_id reply; ret = cmd_snapshot_add_output(cmd_ctx->session, - &cmd_ctx->lsm->u.snapshot_output.output, &reply.id); + &cmd_ctx->lsm->u.snapshot_output.output, &snapshot_id); if (ret != LTTNG_OK) { goto error; } + reply.id = snapshot_id; ret = setup_lttng_msg_no_cmd_header(cmd_ctx, &reply, sizeof(reply)); -- 2.34.1