From 9d2c445d0ac10bf54d39d9aa6e8695c469456489 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 3 Jul 2014 21:31:15 +0200 Subject: [PATCH] cleanup: just safely copy string Keep analyzers happier and use constrained strcpy. --- lib/cache/lvmcache.c | 2 +- lib/format1/import-export.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index 3244205ae..41bac8b5a 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -1707,7 +1707,7 @@ static int _get_pv_if_in_vg(struct lvmcache_info *info, * lvmcache_label_scan() and drop cached * vginfo so make a local copy of string. */ - strcpy(vgname, info->vginfo->vgname); + (void) dm_strncpy(vgname, info->vginfo->vgname, sizeof(vgname)); memcpy(vgid, info->vginfo->vgid, sizeof(vgid)); if (get_pv_from_vg_by_id(info->fmt, vgname, vgid, diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c index 5ef19ef6e..8aa4d3323 100644 --- a/lib/format1/import-export.c +++ b/lib/format1/import-export.c @@ -347,7 +347,7 @@ static void _export_lv(struct lv_disk *lvd, struct volume_group *vg, snprintf((char *)lvd->lv_name, sizeof(lvd->lv_name), "%s%s/%s", dev_dir, vg->name, lv->name); - strcpy((char *)lvd->vg_name, vg->name); + (void) dm_strncpy((char *)lvd->vg_name, vg->name, sizeof(lvd->vg_name)); if (lv->status & LVM_READ) lvd->lv_access |= LV_READ;