Found by Coverity:
CID
1243021 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING)25. buffer_size_warning: Calling strncpy with a
maximum size argument of 255 bytes on destination array (syscall_table +
index).name of size 255 bytes might leave the destination string
unterminated.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
}
syscall_table[index].index = index;
syscall_table[index].bitness = bitness;
- strncpy(syscall_table[index].name, name,
- sizeof(syscall_table[index].name));
+ if (lttng_strncpy(syscall_table[index].name, name,
+ sizeof(syscall_table[index].name))) {
+ ret = -EINVAL;
+ free(syscall_table);
+ syscall_table = NULL;
+ goto error;
+ }
/*
DBG("Syscall name '%s' at index %" PRIu32 " of bitness %u",
syscall_table[index].name,