X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fcmd-2-4.c;h=008be4cf0db901b038e98f3398dc097861847ea4;hp=aeb760a043f773a86ef9d417f31fe36f16854fda;hb=9c256b0146b021962e93fda7400c61ceb2b0d45f;hpb=5312a3edd938117cb5670de711f237e7b6f2e68c diff --git a/src/bin/lttng-relayd/cmd-2-4.c b/src/bin/lttng-relayd/cmd-2-4.c index aeb760a04..008be4cf0 100644 --- a/src/bin/lttng-relayd/cmd-2-4.c +++ b/src/bin/lttng-relayd/cmd-2-4.c @@ -52,9 +52,12 @@ int cmd_create_session_2_4(const struct lttng_buffer_view *payload, ret = -ENAMETOOLONG; ERR("Session name too long"); goto error; + } else if (len == 0) { + ret = -EINVAL; + ERR("Session name can't be of length 0"); + goto error; } - strncpy(session_name, session_info.session_name, - sizeof(session_info.session_name)); + strncpy(session_name, session_info.session_name, LTTNG_NAME_MAX); len = lttng_strnlen(session_info.hostname, sizeof(session_info.hostname)); if (len == sizeof(session_info.hostname) || len >= LTTNG_HOST_NAME_MAX) { @@ -62,8 +65,8 @@ int cmd_create_session_2_4(const struct lttng_buffer_view *payload, ERR("Session name too long"); goto error; } - strncpy(hostname, session_info.hostname, - sizeof(session_info.hostname)); + strncpy(hostname, session_info.hostname, LTTNG_HOST_NAME_MAX); + *live_timer = be32toh(session_info.live_timer); *snapshot = be32toh(session_info.snapshot);