summaryrefslogtreecommitdiff
path: root/toxcore/util.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-04-19 11:28:46 -0400
committerirungentoo <irungentoo@gmail.com>2014-04-19 11:28:46 -0400
commit39ac20fc2daa6a291da9f1fd85735596d684490c (patch)
tree1eb303218d207aede79ff3f2d0056063415e9bfa /toxcore/util.c
parentdb3672bf3f3b8d2f04ba82c82f769732213cf685 (diff)
Fixed possible pointer issues.
Diffstat (limited to 'toxcore/util.c')
-rw-r--r--toxcore/util.c6
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