All of lore.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 3/4] Another fix for garbage send in clvmd message
Date: Thu, 24 Mar 2011 13:25:33 +0100	[thread overview]
Message-ID: <4D8B383D.7060003@redhat.com> (raw)
In-Reply-To: <b9919298acd0f83e1cac3a43bd78164f8dece828.1300965223.git.zkabelac@redhat.com>

On 03/24/2011 12:16 PM, Zdenek Kabelac wrote:

> -	_build_header(head, cmd, node, len);
> +	_build_header(head, cmd, node, len - 1);
>  	memcpy(head->node + strlen(head->node) + 1, data, len);
>  
>  	status = _send_request(outbuf, sizeof(struct clvm_header) +
> -			       strlen(head->node) + len, &retbuf, no_response);
> +			       strlen(head->node) + len - 1, &retbuf, no_response);

ACK, but this protocol _MUST_ be rewritten soon completely.

really, no comment to use of this struct...
(note that if strlen(node) > 0, args points somewhere inside on node name. wonderful.

struct clvm_header {
	uint8_t  cmd;	        /* See below */
...
	char node[1];		/* Actually a NUL-terminated string, node name.
				   If this is empty then the command is 
				   forwarded to all cluster nodes unless 
				   FLAG_LOCAL is also set. */
	char args[1];		/* Arguments for the command follow the 
				   node name, This member is only
				   valid if the node name is empty */

Milan



  reply	other threads:[~2011-03-24 12:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24 11:16 [PATCH 0/4] Valgrind fixes Zdenek Kabelac
2011-03-24 11:16 ` [PATCH 1/4] Reading of unitialized memory Zdenek Kabelac
2011-03-24 12:30   ` Milan Broz
2011-03-24 11:16 ` [PATCH 2/4] Fix access to released memory Zdenek Kabelac
2011-03-24 12:31   ` Milan Broz
2011-03-24 11:16 ` [PATCH 3/4] Another fix for garbage send in clvmd message Zdenek Kabelac
2011-03-24 12:25   ` Milan Broz [this message]
2011-03-24 11:16 ` [PATCH 4/4] Better shutdown for clvmd Zdenek Kabelac
2011-03-24 12:53   ` Milan Broz

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=4D8B383D.7060003@redhat.com \
    --to=mbroz@redhat.com \
    --cc=lvm-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.