Fixed unaligned memory access.

This commit is contained in:
irungentoo_trip 2014-10-21 16:15:49 -04:00
parent 5f26ee201c
commit 3c874bcf62

View File

@ -2648,14 +2648,14 @@ uint32_t messenger_size(const Messenger *m)
static uint8_t *z_state_save_subheader(uint8_t *data, uint32_t len, uint16_t type)
{
uint32_t *data32 = (uint32_t *)data;
data32[0] = len;
data32[1] = (MESSENGER_STATE_COOKIE_TYPE << 16) | type;
data += sizeof(uint32_t) * 2;
memcpy(data, &len, sizeof(uint32_t));
data += sizeof(uint32_t);
uint32_t temp = (MESSENGER_STATE_COOKIE_TYPE << 16) | type;
memcpy(data, &temp, sizeof(uint32_t));
data += sizeof(uint32_t);
return data;
}
/* Save the messenger in data of size Messenger_size(). */
void messenger_save(const Messenger *m, uint8_t *data)
{