summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock
diff options
context:
space:
mode:
authorFrank Kühndel <frank.kuehndel@embedded-brains.de>2020-10-05 16:37:23 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-10-10 15:04:48 +0200
commitbc7ac71f8aaaff0c73469246c526741ec5b181ed (patch)
tree5c608891d691ca6ad67aa1be27d4a08a47a6636d /cpukit/libblock
parentdisp_hcms29xx: Fix string truncation warning (diff)
downloadrtems-bc7ac71f8aaaff0c73469246c526741ec5b181ed.tar.bz2
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]
Diffstat (limited to 'cpukit/libblock')
-rw-r--r--cpukit/libblock/src/bdpart-register.c2
1 files changed, 1 insertions, 1 deletions
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;
}