diff options
Diffstat (limited to 'toxcore/util.c')
-rw-r--r-- | toxcore/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/toxcore/util.c b/toxcore/util.c index d56c446e..44f24f58 100644 --- a/toxcore/util.c +++ b/toxcore/util.c | |||
@@ -99,11 +99,11 @@ int load_state(load_state_callback_func load_state_callback, void *outer, | |||
99 | 99 | ||
100 | uint16_t type; | 100 | uint16_t type; |
101 | uint32_t length_sub, cookie_type; | 101 | uint32_t length_sub, cookie_type; |
102 | uint32_t size32 = sizeof(uint32_t), size_head = size32 * 2; | 102 | uint32_t size_head = sizeof(uint32_t) * 2; |
103 | 103 | ||
104 | while (length >= size_head) { | 104 | while (length >= size_head) { |
105 | length_sub = *(uint32_t *)data; | 105 | memcpy(&length_sub, data, sizeof(length_sub)); |
106 | cookie_type = *(uint32_t *)(data + size32); | 106 | memcpy(&cookie_type, data + sizeof(length_sub), sizeof(cookie_type)); |
107 | data += size_head; | 107 | data += size_head; |
108 | length -= size_head; | 108 | length -= size_head; |
109 | 109 | ||