The lttng client uses the sizeof the containing buffer, defined as
LTTNG_SYMBOL_NAME_LEN, for input string sanitation instead of libc defined
macro NAME_MAX. lttng-enable_channel improperly verified user input
and wrongly discarded valid input in case NAME_MAX was less than the
sizeof the containing buffer for the channel's name.
This patch also fixes potential buffer overflow caused by an improperly
bounded strcpy in the case where NAME_MAX would have been greater than
LTTNG_SYMBOL_NAME_LEN.
Signed-off-by: Yannick Lamarre <ylamarre@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
channel_name = strtok(opt_channels, ",");
while (channel_name != NULL) {
/* Validate channel name's length */
- if (strlen(channel_name) >= NAME_MAX) {
+ if (strlen(channel_name) >= sizeof(chan.name)) {
ERR("Channel name is too long (max. %zu characters)",
sizeof(chan.name) - 1);
error = 1;