X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fconsumer.c;h=44dc35d6b92e3fafd412e35fb95b838f986bb016;hb=4c3f302be806a1c0d0a9049a04c81a7492dab4f7;hp=f89bb1df290fbc8d5f6682e1f1089448974ca40e;hpb=d88744a44aa5f2ca90ab87946692b9eed3120641;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index f89bb1df2..44dc35d6b 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -1460,6 +1460,16 @@ int consumer_snapshot_channel(struct consumer_socket *socket, uint64_t key, if (ret < 0) { ret = -LTTNG_ERR_NOMEM; goto error; + } else if (ret >= sizeof(msg.u.snapshot_channel.pathname)) { + ERR("Snapshot path exceeds the maximal allowed length of %zu bytes (%i bytes required) with path \"%s/%s/%s-%s-%" PRIu64 "%s\"", + sizeof(msg.u.snapshot_channel.pathname), + ret, output->consumer->dst.net.base_dir, + output->consumer->subdir, + output->name, output->datetime, + output->nb_snapshot, + session_path); + ret = -LTTNG_ERR_SNAPSHOT_FAIL; + goto error; } } else { ret = snprintf(msg.u.snapshot_channel.pathname, @@ -1472,7 +1482,16 @@ int consumer_snapshot_channel(struct consumer_socket *socket, uint64_t key, if (ret < 0) { ret = -LTTNG_ERR_NOMEM; goto error; + } else if (ret >= sizeof(msg.u.snapshot_channel.pathname)) { + ERR("Snapshot path exceeds the maximal allowed length of %zu bytes (%i bytes required) with path \"%s/%s-%s-%" PRIu64 "%s\"", + sizeof(msg.u.snapshot_channel.pathname), + ret, output->consumer->dst.session_root_path, + output->name, output->datetime, output->nb_snapshot, + session_path); + ret = -LTTNG_ERR_SNAPSHOT_FAIL; + goto error; } + msg.u.snapshot_channel.relayd_id = (uint64_t) -1ULL; /* Create directory. Ignore if exist. */ @@ -1752,7 +1771,7 @@ int consumer_rotate_pending_relay(struct consumer_socket *socket, assert(socket); - DBG("Consumer rotate pending on relay for session %" PRIu64 ", chunk id % " PRIu64, + DBG("Consumer rotate pending on relay for session %" PRIu64 ", chunk id %" PRIu64, session_id, chunk_id); assert(output->type == CONSUMER_DST_NET);