1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

cleanup: just safely copy string

Keep analyzers happier and use constrained strcpy.
This commit is contained in:
Zdenek Kabelac 2014-07-03 21:31:15 +02:00
parent 86e116450e
commit 9d2c445d0a
2 changed files with 2 additions and 2 deletions

View File

@ -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,

View File

@ -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;