X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fkernel-consumer.c;h=ea16e1d1a7fb2b3711b8f73d0daba3938c5553e0;hb=638e7b4ef8bf5b7f78d5c01dd3643daea8e8f084;hp=160c19f598329ec03c6d82023ad55f09bc38db03;hpb=d40f035921a2d3be652d31bdcc250db521f96209;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/kernel-consumer.c b/src/bin/lttng-sessiond/kernel-consumer.c index 160c19f59..ea16e1d1a 100644 --- a/src/bin/lttng-sessiond/kernel-consumer.c +++ b/src/bin/lttng-sessiond/kernel-consumer.c @@ -52,6 +52,13 @@ static char *create_channel_path(struct consumer_output *consumer, if (ret < 0) { PERROR("snprintf kernel channel path"); goto error; + } else if (ret >= sizeof(tmp_path)) { + ERR("Kernel channel path exceeds the maximal allowed length of of %zu bytes (%i bytes required) with path \"%s%s%s\"", + sizeof(tmp_path), ret, + consumer->dst.session_root_path, + consumer->chunk_path, + consumer->subdir); + goto error; } pathname = lttng_strndup(tmp_path, sizeof(tmp_path)); if (!pathname) { @@ -75,6 +82,12 @@ static char *create_channel_path(struct consumer_output *consumer, if (ret < 0) { PERROR("snprintf kernel metadata path"); goto error; + } else if (ret >= sizeof(tmp_path)) { + ERR("Kernel channel path exceeds the maximal allowed length of of %zu bytes (%i bytes required) with path \"%s%s\"", + sizeof(tmp_path), ret, + consumer->dst.net.base_dir, + consumer->subdir); + goto error; } pathname = lttng_strndup(tmp_path, sizeof(tmp_path)); if (!pathname) { @@ -132,8 +145,7 @@ int kernel_consumer_add_channel(struct consumer_socket *sock, } /* Prep channel message structure */ - consumer_init_channel_comm_msg(&lkm, - LTTNG_CONSUMER_ADD_CHANNEL, + consumer_init_add_channel_comm_msg(&lkm, channel->key, ksession->id, pathname, @@ -216,8 +228,7 @@ int kernel_consumer_add_metadata(struct consumer_socket *sock, } /* Prep channel message structure */ - consumer_init_channel_comm_msg(&lkm, - LTTNG_CONSUMER_ADD_CHANNEL, + consumer_init_add_channel_comm_msg(&lkm, session->metadata->key, session->id, pathname,