Some versions of GCC when called with -Wstringop-truncation will warn
when doing a copy of the same size as the destination buffer with
strncpy :
‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation]
Since we unconditionally write '\0' in the last byte, reduce the copy
size by one.
Change-Id: Idb907c9550817a06fc0dffc489740f63d440e7d4
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
break;
}
- strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
+ strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN - 1);
ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
ev.instrumentation = LTTNG_KERNEL_SYSCALL;
chan_table[i] = _lttng_event_create(chan, &ev, filter,