1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-30 10:50:34 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2011-03-29 21:05:39 +00:00
parent 9e1eeffe6f
commit 999238d4fa
3 changed files with 9 additions and 5 deletions

View File

@ -20,7 +20,7 @@ Version 2.02.85 -
Avoid possible endless loop in _free_vginfo when 4 or more VGs have same name.
Use empty string instead of /dev// for LV path when there's no VG.
Don't allocate unused VG mempool in _pvsegs_sub_single.
Remove uninitialised byte from end of local clvmd messages.
Do not send uninitialised bytes in local clvmd messages.
Support --help option for clvmd and return error for unknown option.
Use system page size and not hardcoded value in locking code check.
Fix reading of released memory for printing segment type.

View File

@ -154,6 +154,7 @@ static void _build_header(struct clvm_header *head, int cmd, const char *node,
head->cmd = cmd;
head->status = 0;
head->flags = 0;
head->xid = 0;
head->clientid = 0;
head->arglen = len;
@ -197,11 +198,12 @@ static int _cluster_request(char cmd, const char *node, void *data, int len,
if (_clvmd_sock == -1)
return 0;
_build_header(head, cmd, node, len);
/* 1 byte is used from struct clvm_header.args[1], so -> len - 1 */
_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);
if (!status || no_response)
goto out;

View File

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