LTTNG_PATH_MAX and LTTNG_NAME_MAX are mixed up in
cmd_create_session_2_4(). While Coverity warns of a possible buffer
overrun, this is not possible since the length of the received
buffer is correctly checked against LTTNG_NAME_MAX.
Change the use of LTTNG_PATH_MAX for LTTNG_NAME_MAX even though
strcpy() could be used safely here.
1405634 Out-of-bounds access
Access of memory not owned by this buffer may cause crashes or incorrect computations.
In relay_create_session: Out-of-bounds access to a buffer (CWE-119)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
ERR("Session name too long");
goto error;
}
- strncpy(session_name, session_info.session_name, LTTNG_PATH_MAX);
+ 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) {