forked from Imagelibrary/rtems
libblock: Fix string truncation warning
This patch does not only fix the compiler warning below. memcpy() is the better function at this place as the terminating NUL character is never copied here. Instead more characters will be appended to the 'logical_disk_name' later on. ../../../cpukit/libblock/src/bdpart-register.c:41:5: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
This commit is contained in:
committed by
Sebastian Huber
parent
f28a6defd1
commit
bc7ac71f8a
@@ -38,7 +38,7 @@ static char *create_logical_disk_name( const char *disk_name, char **marker)
|
||||
char *logical_disk_name = malloc( disk_name_size + RTEMS_BDPART_NUMBER_SIZE);
|
||||
|
||||
if (logical_disk_name != NULL) {
|
||||
strncpy( logical_disk_name, disk_name, disk_name_size);
|
||||
memcpy( logical_disk_name, disk_name, disk_name_size);
|
||||
*marker = logical_disk_name + disk_name_size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user