From b84702349f1d2070ac85115cc70576dba2050a30 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 25 Mar 2024 16:37:04 +0100 Subject: [PATCH] cov: ensure buffer is nul ended Use dm_strncpy() to ensure ending nul. --- lib/device/online.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/device/online.c b/lib/device/online.c index 15972de94..cbdce2edf 100644 --- a/lib/device/online.c +++ b/lib/device/online.c @@ -181,9 +181,9 @@ int get_pvs_online(struct dm_list *pvs_online, const char *vgname) if (file_major || file_minor) po->devno = MKDEV(file_major, file_minor); if (file_vgname[0]) - strncpy(po->vgname, file_vgname, NAME_LEN); + (void)dm_strncpy(po->vgname, file_vgname, sizeof(po->vgname)); if (file_devname[0]) - strncpy(po->devname, file_devname, NAME_LEN); + (void)dm_strncpy(po->devname, file_devname, sizeof(po->devname)); log_debug("Found PV online %s for VG %s %s", path, vgname, file_devname); dm_list_add(pvs_online, &po->list);