diff options
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/network.c | 9 | ||||
-rw-r--r-- | toxcore/tox.h | 7 |
2 files changed, 10 insertions, 6 deletions
diff --git a/toxcore/network.c b/toxcore/network.c index e5a80254..82f29aef 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -310,9 +310,12 @@ typedef struct { | |||
310 | 310 | ||
311 | int networking_wait_prepare(Networking_Core *net, uint32_t sendqueue_length, uint8_t *data, uint16_t *lenptr) | 311 | int networking_wait_prepare(Networking_Core *net, uint32_t sendqueue_length, uint8_t *data, uint16_t *lenptr) |
312 | { | 312 | { |
313 | if ((data == NULL) || (*lenptr < sizeof(select_info))) { | 313 | if ((data == NULL) || !lenptr || (*lenptr < sizeof(select_info))) { |
314 | *lenptr = sizeof(select_info); | 314 | if (lenptr) { |
315 | return 0; | 315 | *lenptr = sizeof(select_info); |
316 | return 0; | ||
317 | } else | ||
318 | return -1; | ||
316 | } | 319 | } |
317 | 320 | ||
318 | *lenptr = sizeof(select_info); | 321 | *lenptr = sizeof(select_info); |
diff --git a/toxcore/tox.h b/toxcore/tox.h index 08727d2a..469a1f78 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -606,10 +606,11 @@ void tox_do(Tox *tox); | |||
606 | * Prepares the data required to call tox_wait_execute() asynchronously | 606 | * Prepares the data required to call tox_wait_execute() asynchronously |
607 | * | 607 | * |
608 | * data[] is reserved and kept by the caller | 608 | * data[] is reserved and kept by the caller |
609 | * len is in/out: in = reserved data[], out = required data[] | 609 | * *lenptr is in/out: in = reserved data[], out = required data[] |
610 | * | 610 | * |
611 | * returns 1 on success | 611 | * returns 1 on success |
612 | * returns 0 on failure (length is insufficient) | 612 | * returns 0 if *lenptr is insufficient |
613 | * returns -1 if lenptr is NULL | ||
613 | * | 614 | * |
614 | * | 615 | * |
615 | * tox_wait_execute(): function can be called asynchronously | 616 | * tox_wait_execute(): function can be called asynchronously |