File pacemaker-libcrmcommon-compressed-message-header.patch of Package pacemaker.3577
commit b96601712eb4a9f4310bb83db226aac067cc3c83
Author: Michal Koutný <mkoutny@suse.com>
Date: Thu Jan 7 12:42:51 2016 +0100
Fix: header == NULL when parsing compressed message
When parsing a compressed message, message header is reloaded from the
uncompressed buffer. However, because remote->buffer_offset is zeroed
prior that, it'll consider the buffer already processed and return NULL.
Zeoring remote->buffer_offset after header retrieval should remedy this.
AFAICS, the decompression branch is not used so this perhaps is not an
issue in the real world.
diff --git a/lib/common/remote.c b/lib/common/remote.c
index 24c94c3..2aea6ab 100644
--- a/lib/common/remote.c
+++ b/lib/common/remote.c
@@ -383,9 +383,6 @@ crm_remote_parse_buffer(crm_remote_t * remote)
return NULL;
}
- /* take ownership of the buffer */
- remote->buffer_offset = 0;
-
/* Support compression on the receiving end now, in case we ever want to add it later */
if (header->payload_compressed) {
int rc = 0;
@@ -421,6 +418,9 @@ crm_remote_parse_buffer(crm_remote_t * remote)
header = crm_remote_header(remote);
}
+ /* take ownership of the buffer */
+ remote->buffer_offset = 0;
+
CRM_LOG_ASSERT(remote->buffer[sizeof(struct crm_remote_header_v0) + header->payload_uncompressed - 1] == 0);
xml = string2xml(remote->buffer + header->payload_offset);