Bugfix: Buffer position overflow because of terminating NULL byte the library adds to payload

This commit is contained in:
Johannes Schriewer 2018-07-30 02:56:46 +02:00
parent 1d134a23c9
commit df5faa77c9

View file

@ -221,7 +221,7 @@ bool decode_publish(Buffer *buffer, PublishPayload *payload, size_t sz) {
payload->message = malloc(len);
memcpy(payload->message, buffer->data + buffer->position, len - 1);
payload->message[len] = '\0';
buffer->position += len;
buffer->position += len - 1;
}
return true;