From bf5cb4af8e7722a4b29bff0caf23a1c5a167a360 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 7 May 2015 11:28:22 +0200 Subject: [PATCH] lvmcache: copy just 32bytes Copy only bytes which fits. vginfo->vgid is [ID_LEN + 1] vgsummary->vgid has only [ID_LEN] Reported by Coverity. --- WHATS_NEW | 1 + lib/cache/lvmcache.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index 41f873930..87ce45cff 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.120 - =============================== + Fix storing of vgid when caching metadata (2.02.118). Fix recursive lvm-config man page. (2.02.119) Refactor polldaemon interfaces to poll every operation by VG/LV couple Skip wait after testing in _wait_for_single_lv when polling finished diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index 90e7b2843..0d13c16b9 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -2233,7 +2233,8 @@ int lvmcache_lookup_mda(struct lvmcache_vgsummary *vgsummary) vgsummary->vgname = vginfo->vgname; vgsummary->creation_host = vginfo->creation_host; vgsummary->vgstatus = vginfo->status; - memcpy((char *)&vgsummary->vgid, vginfo->vgid, sizeof(vginfo->vgid)); + /* vginfo->vgid has 1 extra byte then vgsummary->vgid */ + memcpy(&vgsummary->vgid, vginfo->vgid, sizeof(vgsummary->vgid)); return 1; }