+ if (payload->size < sizeof(session_info)) {
+ ERR("Unexpected payload size in \"cmd_create_session_2_4\": expected >= %zu bytes, got %zu bytes",
+ sizeof(session_info), payload->size);
+ ret = -1;
+ goto error;
+ }
+ memcpy(&session_info, payload->data, sizeof(session_info));
+
+ len = lttng_strnlen(session_info.session_name, sizeof(session_info.session_name));
+ /* Ensure that NULL-terminated and fits in local filename length. */
+ if (len == sizeof(session_info.session_name) || len >= LTTNG_NAME_MAX) {
+ 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, LTTNG_NAME_MAX);