mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-04 09:18:36 +03:00
cleanup: just safely copy string
Keep analyzers happier and use constrained strcpy.
This commit is contained in:
parent
86e116450e
commit
9d2c445d0a
2
lib/cache/lvmcache.c
vendored
2
lib/cache/lvmcache.c
vendored
@ -1707,7 +1707,7 @@ static int _get_pv_if_in_vg(struct lvmcache_info *info,
|
|||||||
* lvmcache_label_scan() and drop cached
|
* lvmcache_label_scan() and drop cached
|
||||||
* vginfo so make a local copy of string.
|
* 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));
|
memcpy(vgid, info->vginfo->vgid, sizeof(vgid));
|
||||||
|
|
||||||
if (get_pv_from_vg_by_id(info->fmt, vgname, vgid,
|
if (get_pv_from_vg_by_id(info->fmt, vgname, vgid,
|
||||||
|
@ -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",
|
snprintf((char *)lvd->lv_name, sizeof(lvd->lv_name), "%s%s/%s",
|
||||||
dev_dir, vg->name, lv->name);
|
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)
|
if (lv->status & LVM_READ)
|
||||||
lvd->lv_access |= LV_READ;
|
lvd->lv_access |= LV_READ;
|
||||||
|
Loading…
Reference in New Issue
Block a user