Skip to contentSkip to conversation

rgmanager: reslist: fix insufficient null-termination

PATCH New Jan Pokorný 1 participant 1 message Jun 1, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rgmanager: reslist: fix insufficient null-termination

Previously, garbage could be part of the copied data (my bad). This version should be sane in this regard.

References:
commit (STABLE32):
http://git.fedorahosted.org/git/?p=cluster.git;a=commit;h=a14f392
https://www.redhat.com/archives/cluster-devel/2012-April/msg00019.html

---
 rgmanager/src/daemons/reslist.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
rgmanager/src/daemons/reslist.c +1 -1
index 43430cd..3c05df7 100644
@@ -111,7 +111,7 @@ _attr_value(resource_node_t *node, const char *attrname, const char *ptype)
 			len = sizeof(p_type) - 1;
 
 		memcpy(p_type, ra->ra_value, len);
-		p_type[sizeof(p_type)-1] = '\0';
+		p_type[len] = '\0';
 
 		/* Skip the "%" and recurse */
 		return _attr_value(node->rn_parent, ++c, p_type);