diff options
author | irungentoo <irungentoo@gmail.com> | 2014-04-15 19:16:35 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-04-15 19:16:35 -0400 |
commit | be413de39624c6137e577e3bff14928d2cb873d3 (patch) | |
tree | b0605725214d421d6ebb177e60f3a29df54b4fb8 /toxcore/onion_announce.c | |
parent | f9bf7b074acd29b0448d36a66db4339c6ae659c4 (diff) |
Fixed regression, announce responses can contain 0 nodes.
Diffstat (limited to 'toxcore/onion_announce.c')
-rw-r--r-- | toxcore/onion_announce.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/toxcore/onion_announce.c b/toxcore/onion_announce.c index a1e5495e..7a60a235 100644 --- a/toxcore/onion_announce.c +++ b/toxcore/onion_announce.c | |||
@@ -268,10 +268,14 @@ static int handle_announce_request(void *object, IP_Port source, uint8_t *packet | |||
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | int nodes_length = pack_nodes(pl + 1 + ONION_PING_ID_SIZE, sizeof(nodes_list), nodes_list, num_nodes); | 271 | int nodes_length = 0; |
272 | 272 | ||
273 | if (nodes_length <= 0) | 273 | if (num_nodes != 0) { |
274 | return 1; | 274 | nodes_length = pack_nodes(pl + 1 + ONION_PING_ID_SIZE, sizeof(nodes_list), nodes_list, num_nodes); |
275 | |||
276 | if (nodes_length <= 0) | ||
277 | return 1; | ||
278 | } | ||
275 | 279 | ||
276 | uint8_t data[ONION_ANNOUNCE_RESPONSE_MAX_SIZE]; | 280 | uint8_t data[ONION_ANNOUNCE_RESPONSE_MAX_SIZE]; |
277 | len = encrypt_data_fast(shared_key, nonce, pl, 1 + ONION_PING_ID_SIZE + nodes_length, | 281 | len = encrypt_data_fast(shared_key, nonce, pl, 1 + ONION_PING_ID_SIZE + nodes_length, |