strncpy is used with the source length of both session_name and
hostname. This doesn't make sense at face value. However, this is not
a "bug" as both src and dst are guaranteed to be the same length in
all existing code paths.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
ERR("Session name too long");
goto error;
}
ERR("Session name too long");
goto error;
}
- strncpy(session_name, session_info.session_name,
- sizeof(session_info.session_name));
+ strncpy(session_name, session_info.session_name, LTTNG_PATH_MAX);
len = lttng_strnlen(session_info.hostname, sizeof(session_info.hostname));
if (len == sizeof(session_info.hostname) || len >= LTTNG_HOST_NAME_MAX) {
len = lttng_strnlen(session_info.hostname, sizeof(session_info.hostname));
if (len == sizeof(session_info.hostname) || len >= LTTNG_HOST_NAME_MAX) {
ERR("Session name too long");
goto error;
}
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);
*live_timer = be32toh(session_info.live_timer);
*snapshot = be32toh(session_info.snapshot);