summaryrefslogtreecommitdiff
path: root/toxcore/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/util.c')
-rw-r--r--toxcore/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toxcore/util.c b/toxcore/util.c
index 51b31e7b..b3263d05 100644
--- a/toxcore/util.c
+++ b/toxcore/util.c
@@ -58,7 +58,7 @@ int load_state(load_state_callback_func load_state_callback, void *outer,
58 uint32_t length_sub, cookie_type; 58 uint32_t length_sub, cookie_type;
59 uint32_t size32 = sizeof(uint32_t), size_head = size32 * 2; 59 uint32_t size32 = sizeof(uint32_t), size_head = size32 * 2;
60 60
61 while (length > size_head) { 61 while (length >= size_head) {
62 length_sub = *(uint32_t *)data; 62 length_sub = *(uint32_t *)data;
63 cookie_type = *(uint32_t *)(data + size32); 63 cookie_type = *(uint32_t *)(data + size32);
64 data += size_head; 64 data += size_head;
@@ -89,7 +89,7 @@ int load_state(load_state_callback_func load_state_callback, void *outer,
89 length -= length_sub; 89 length -= length_sub;
90 } 90 }
91 91
92 return length == 0 ? 0 : - 1; 92 return length == 0 ? 0 : -1;
93}; 93};
94 94
95#ifdef LOGGING 95#ifdef LOGGING