summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-11-27 17:43:51 -0800
committerirungentoo <irungentoo@gmail.com>2013-11-27 17:43:51 -0800
commit3d5a1d96181e7cd92f673fc1bdf575baf81b8d12 (patch)
tree5ba47b03e8ce6f6122ca1cf3f6b7156fdda1e523 /toxcore
parent8dd33bb306cd63c8a8f692edc7c24f55d3c4bd6c (diff)
parent26fef7cf9a5470e5fd24300063be6df3cd9ce723 (diff)
Merge pull request #666 from FullName/nTox-various
Various changes to nTox including a potential crash (also possible from remote!)...
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/network.c9
-rw-r--r--toxcore/tox.h7
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
311int networking_wait_prepare(Networking_Core *net, uint32_t sendqueue_length, uint8_t *data, uint16_t *lenptr) 311int 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