From ee7375ca896d478964b9fbc2b6589a44405a8737 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 7 Jun 2014 06:44:05 +0200 Subject: fix message marshal error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libmdsserver/mds-message.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/libmdsserver') diff --git a/src/libmdsserver/mds-message.c b/src/libmdsserver/mds-message.c index c70bb15..66e8946 100644 --- a/src/libmdsserver/mds-message.c +++ b/src/libmdsserver/mds-message.c @@ -426,7 +426,7 @@ size_t mds_message_marshal_size(const mds_message_t* restrict this) for (i = 0; i < this->header_count; i++) rc += strlen(this->headers[i]); rc *= sizeof(char); - rc += 4 * sizeof(size_t) + 1 * sizeof(int); + rc += 4 * sizeof(size_t) + 2 * sizeof(int); return rc; } @@ -483,6 +483,7 @@ int mds_message_unmarshal(mds_message_t* restrict this, char* restrict data) buf_get_next(data, size_t, this->payload_size); buf_get_next(data, size_t, this->payload_ptr); buf_get_next(data, size_t, this->buffer_size = this->buffer_ptr); + buf_get_next(data, int, this->stage); /* Make sure that the pointers are NULL so that they are not freed without being allocated when the message is @@ -491,8 +492,6 @@ int mds_message_unmarshal(mds_message_t* restrict this, char* restrict data) this->payload = NULL; this->buffer = NULL; - buf_get_next(data, int, this->stage); - /* To 2-power-multiple of 128 bytes. */ this->buffer_size >>= 7; if (this->buffer_size == 0) -- cgit v1.2.3-70-g09d2