From bc7ac71f8aaaff0c73469246c526741ec5b181ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20K=C3=BChndel?= Date: Mon, 5 Oct 2020 16:37:23 +0200 Subject: 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] --- cpukit/libblock/src/bdpart-register.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cpukit/libblock') diff --git a/cpukit/libblock/src/bdpart-register.c b/cpukit/libblock/src/bdpart-register.c index 9956e61a68..8a1de6135e 100644 --- a/cpukit/libblock/src/bdpart-register.c +++ b/cpukit/libblock/src/bdpart-register.c @@ -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; } -- cgit v1.2.3