Some version of g++ emits the following warning:
'char* strncpy(char*, const char*, size_t)' output may be truncated
copying 255 bytes from a string of length 255 [-Wstringop-truncation]
Using the internal strncpy wrapper, which checks for truncation,
fixes the problem.
Change-Id: I8ab0f2cca0247eee329b137f547d3dfed32c995f
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
}
/* Copy event name */
- strncpy(local_ust_event->attr.name, ev->name, LTTNG_UST_ABI_SYM_NAME_LEN);
+ if (lttng_strncpy(local_ust_event->attr.name, ev->name, LTTNG_UST_ABI_SYM_NAME_LEN)) {
+ ret = LTTNG_ERR_INVALID;
+ goto error;
+ }
+
local_ust_event->attr.name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] = '\0';
switch (ev->loglevel_type) {