cluster: STABLE32 - rgmanager: reslist: fix insufficient null-termination

Ryan McCabe rmccabe at fedoraproject.org
Fri Jun 1 15:24:15 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e187243a94a979ebc219d6f39134811b4c9471cb
Commit:        e187243a94a979ebc219d6f39134811b4c9471cb
Parent:        c0afc6f3180dd61c9b212e2eb61cdc8d9c56af9f
Author:        Jan Pokorný <jpokorny at redhat.com>
AuthorDate:    Fri Jun 1 17:11:23 2012 +0200
Committer:     Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Fri Jun 1 11:23:52 2012 -0400

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

Signed-off-by: Jan Pokorný <jpokorny at redhat.com>
Signed-off-by: Ryan McCabe <rmccabe at redhat.com>
---
 rgmanager/src/daemons/reslist.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/rgmanager/src/daemons/reslist.c b/rgmanager/src/daemons/reslist.c
index 43430cd..3c05df7 100644
--- a/rgmanager/src/daemons/reslist.c
+++ b/rgmanager/src/daemons/reslist.c
@@ -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);


More information about the cluster-commits mailing list