Index: src/OFDataArray+MessagePackValue.m ================================================================== --- src/OFDataArray+MessagePackValue.m +++ src/OFDataArray+MessagePackValue.m @@ -13,10 +13,12 @@ * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" + +#include #import "OFDataArray+MessagePackValue.h" #import "OFNumber.h" #import "OFNull.h" #import "OFDataArray.h" @@ -196,11 +198,11 @@ if ((buffer[0] & 0xF0) == 0x80) return parseTable(buffer + 1, length - 1, object, buffer[0] & 0xF, depthLimit) + 1; /* Prefix byte */ - switch (*buffer) { + switch (buffer[0]) { /* Unsigned integers */ case 0xCC: /* uint8 */ if (length < 2) goto error; @@ -257,12 +259,11 @@ } f; if (length < 5) goto error; - for (size_t i = 0; i < 4; i++) - f.u8[i] = buffer[i + 1]; + memcpy(&f.u8, buffer + 1, 4); *object = [OFNumber numberWithFloat: OF_BSWAP_FLOAT_IF_LE(f.f)]; return 5; case 0xCB:; /* float 64 */ union { @@ -271,12 +272,11 @@ } d; if (length < 9) goto error; - for (size_t i = 0; i < 8; i++) - d.u8[i] = buffer[i + 1]; + memcpy(&d.u8, buffer + 1, 8); *object = [OFNumber numberWithDouble: OF_BSWAP_DOUBLE_IF_LE(d.d)]; return 9; /* nil */