diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2011-03-29 21:05:39 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2011-03-29 21:05:39 +0000 |
commit | 7f0d89f8b4d70b5229f6ae93e81e985175e82e62 (patch) | |
tree | e46c16defa532429aca612df58a914004087fdbe /lib | |
parent | aaf92617b0ad642ec99483141ad588982cf921d8 (diff) | |
download | lvm2-7f0d89f8b4d70b5229f6ae93e81e985175e82e62.tar.gz lvm2-7f0d89f8b4d70b5229f6ae93e81e985175e82e62.tar.xz lvm2-7f0d89f8b4d70b5229f6ae93e81e985175e82e62.zip |
Fix sending uninitilised bytes in cluster messages
Fix 2 more functions sending cluster messages to avoid passing uninitilised bytes
and compensate 1 extra byte attached to the message from the clvm_header.args[1]
member variable.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/locking/cluster_locking.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/locking/cluster_locking.c b/lib/locking/cluster_locking.c index 4dac05f9..99ac4125 100644 --- a/lib/locking/cluster_locking.c +++ b/lib/locking/cluster_locking.c @@ -173,6 +173,7 @@ static void _build_header(struct clvm_header *head, int clvmd_cmd, const char *n head->cmd = clvmd_cmd; head->status = 0; head->flags = 0; + head->xid = 0; head->clientid = 0; head->arglen = len; @@ -216,11 +217,12 @@ static int _cluster_request(char clvmd_cmd, const char *node, void *data, int le if (_clvmd_sock == -1) return 0; - _build_header(head, clvmd_cmd, node, len); + /* 1 byte is used from struct clvm_header.args[1], so -> len - 1 */ + _build_header(head, clvmd_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); + strlen(head->node) + len - 1, &retbuf); if (!status) goto out; |