Skip to contentSkip to conversation

master - lvmcache: fix debug trace

PATCH Zdenek Kabelac 1 participant 1 message Mar 21, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e5382c063d2549d3a28b3182218b7978e0c22442
Commit:        e5382c063d2549d3a28b3182218b7978e0c22442
Parent:        fc280bcc42556ca1c78d897839d05b3688d9d65b
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Mar 19 23:35:36 2014 +0100
Committer:     Zdenek Kabelac <[email protected]>
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(-)
lib/cache/lvmcache.c +2 -2
index 0c49ccf..c61bb77 100644
@@ -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;
 }