From: Jérémie Galarneau Date: Sat, 14 Sep 2019 20:16:56 +0000 (-0400) Subject: sessiond: fix: possible unaligned access in packed structure X-Git-Tag: v2.12.0-rc1~382 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=a914e76ac1a529191035f1fec439026c83beee3f sessiond: fix: possible unaligned access in packed structure 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 --- 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));