cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Jan Pokorný <jpokorny@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] rgmanager: reslist: fix insufficient null-termination
Date: Fri, 1 Jun 2012 17:11:23 +0200	[thread overview]
Message-ID: <20120601151123.GA19378@redhat.com> (raw)

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@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);



                 reply	other threads:[~2012-06-01 15:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120601151123.GA19378@redhat.com \
    --to=jpokorny@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).