#include <common/defaults.h>
#include <common/error.h>
#include <common/config/config.h>
#include <common/defaults.h>
#include <common/error.h>
#include <common/config/config.h>
#include <common/utils.h>
#include <common/runas.h>
#include <lttng/save-internal.h>
#include <common/utils.h>
#include <common/runas.h>
#include <lttng/save-internal.h>
ret = config_writer_open_element(writer, config_element_perf);
if (ret) {
ret = LTTNG_ERR_SAVE_IO_FAIL;
ret = config_writer_open_element(writer, config_element_perf);
if (ret) {
ret = LTTNG_ERR_SAVE_IO_FAIL;
if (!session_access_ok(session,
LTTNG_SOCK_GET_UID_CRED(creds),
if (!session_access_ok(session,
LTTNG_SOCK_GET_UID_CRED(creds),
- * Check the path fits in PATH_MAX, including the / followed by trailing
- * .lttng extension and the NULL terminated string.
+ * Check the path fits in the config file path dst including the '/'
+ * followed by trailing .lttng extension and the NULL terminated string.
- if (len + session_name_len + 2 +
- sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION) > PATH_MAX) {
+ if ((len + session_name_len + 2 +
+ sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION))
+ > sizeof(config_file_path)) {
config_file_path[len++] = '/';
strncpy(config_file_path + len, session->name, session_name_len);
len += session_name_len;
strcpy(config_file_path + len, DEFAULT_SESSION_CONFIG_FILE_EXTENSION);
config_file_path[len++] = '/';
strncpy(config_file_path + len, session->name, session_name_len);
len += session_name_len;
strcpy(config_file_path + len, DEFAULT_SESSION_CONFIG_FILE_EXTENSION);