[lvm-devel] master - lvmcache: fix debug trace

Zdenek Kabelac zkabelac at fedoraproject.org
Fri Mar 21 21:31:23 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e5382c063d2549d3a28b3182218b7978e0c22442
Commit:        e5382c063d2549d3a28b3182218b7978e0c22442
Parent:        fc280bcc42556ca1c78d897839d05b3688d9d65b
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Wed Mar 19 23:35:36 2014 +0100
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Fri Mar 21 22:29:22 2014 +0100

lvmcache: fix debug trace

Recent debug tracing commit introduce read of uninitialized memory,
since VGID is not really a proper string which ends with '\0'.
Enforce at most 32 (ID_LEN) chars are read from vgid.
(in release fix)
---
 lib/cache/lvmcache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 0c49ccf..c61bb77 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -446,8 +446,8 @@ struct lvmcache_vginfo *lvmcache_vginfo_from_vgname(const char *vgname, const ch
 		while ((vginfo = vginfo->next));
 
 	if  (!vginfo)
-		log_debug_cache("Metadata cache has not found vgname \"%s\" with vgid \"%s\"",
-				vgname, vgid);
+		log_debug_cache("Metadata cache has not found vgname \"%s\" with vgid \"%."
+				DM_TO_STRING(ID_LEN) "s\".", vgname, vgid ? : "");
 
 	return vginfo;
 }




More information about the lvm-devel mailing list