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.11.0-rc4~35 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c5ea08236b0e60d18f272c5bb0fe02ec52dbcff4;p=lttng-tools.git 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));