mirror of
https://github.com/TokTok/c-toxcore
synced 2026-06-06 22:02:34 +00:00
Fixed unaligned memory access.
This commit is contained in:
+5
-5
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user