summaryrefslogtreecommitdiff
path: root/toxcore/util.c
diff options
context:
space:
mode:
authorCoren[m] <Break@Ocean>2013-09-14 10:43:09 +0200
committerCoren[m] <Break@Ocean>2013-09-14 10:43:09 +0200
commita341b259b6342962e209f1b50708abe40f1cdad2 (patch)
tree167a6809cf3d5e186a2f9ccf2da8693a3b417d89 /toxcore/util.c
parentd2603cf169b1b2d860f2b851590f5ae2be01011c (diff)
Change sublength to 32 bits. Someone might have more than (sizeof(Friends) / 65536) friends...
Diffstat (limited to 'toxcore/util.c')
-rw-r--r--toxcore/util.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toxcore/util.c b/toxcore/util.c
index 55b51709..653e8d5f 100644
--- a/toxcore/util.c
+++ b/toxcore/util.c
@@ -56,13 +56,13 @@ int load_state(load_state_callback_func load_state_callback, void *outer,
56 return -1; 56 return -1;
57 } 57 }
58 58
59 state_length_sub_t length_sub; 59
60 uint16_t type; 60 uint16_t type;
61 uint32_t size32 = sizeof(uint32_t), length_sub_len = sizeof(state_length_sub_t); 61 uint32_t length_sub, cookie_type;
62 uint32_t size_head = length_sub_len + size32, cookie_type; 62 uint32_t size32 = sizeof(uint32_t), size_head = size32 * 2;
63 while (length > size_head) { 63 while (length > size_head) {
64 length_sub = *(state_length_sub_t *)data; 64 length_sub = *(uint32_t *)data;
65 cookie_type = *(uint32_t *)(data + length_sub_len); 65 cookie_type = *(uint32_t *)(data + size32);
66 data += size_head; 66 data += size_head;
67 length -= size_head; 67 length -= size_head;
68 68