diff options
author | Gabor X Toth <*@tg-x.net> | 2015-09-13 07:49:59 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2015-09-13 07:49:59 +0000 |
commit | 646e102680bff31286fa731aa5393f0eea19afe2 (patch) | |
tree | 4d1a39d33aef2e15f3c8ecd9d7b0c0a747a34ec2 /src/multicast/multicast_api.c | |
parent | c547a9dbe17b3566556557b9d88971cdc2b02ac2 (diff) | |
download | gnunet-646e102680bff31286fa731aa5393f0eea19afe2.tar.gz gnunet-646e102680bff31286fa731aa5393f0eea19afe2.zip |
multicast tests
Diffstat (limited to 'src/multicast/multicast_api.c')
-rw-r--r-- | src/multicast/multicast_api.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c index c8d82e892..ef4cc73e7 100644 --- a/src/multicast/multicast_api.c +++ b/src/multicast/multicast_api.c | |||
@@ -327,18 +327,29 @@ member_recv_join_decision (void *cls, | |||
327 | uint16_t relay_count = ntohl (dcsn->relay_count); | 327 | uint16_t relay_count = ntohl (dcsn->relay_count); |
328 | const struct GNUNET_PeerIdentity *relays = NULL; | 328 | const struct GNUNET_PeerIdentity *relays = NULL; |
329 | uint16_t relay_size = relay_count * sizeof (*relays); | 329 | uint16_t relay_size = relay_count * sizeof (*relays); |
330 | if (0 < relay_count && dcsn_size < sizeof (*dcsn) + relay_size) | 330 | if (0 < relay_count) |
331 | relays = (struct GNUNET_PeerIdentity *) &dcsn[1]; | 331 | { |
332 | if (dcsn_size < sizeof (*dcsn) + relay_size) | ||
333 | { | ||
334 | GNUNET_break_op (0); | ||
335 | is_admitted = GNUNET_SYSERR; | ||
336 | } | ||
337 | else | ||
338 | { | ||
339 | relays = (struct GNUNET_PeerIdentity *) &dcsn[1]; | ||
340 | } | ||
341 | } | ||
332 | 342 | ||
333 | if (sizeof (*dcsn) + relay_size + sizeof (*join_resp) <= dcsn_size) | 343 | if (sizeof (*dcsn) + relay_size + sizeof (*join_resp) <= dcsn_size) |
334 | { | 344 | { |
335 | join_resp = (const struct GNUNET_MessageHeader *) &dcsn[1]; | 345 | join_resp = (const struct GNUNET_MessageHeader *) ((char *) &dcsn[1] + relay_size); |
336 | join_resp_size = ntohs (join_resp->size); | 346 | join_resp_size = ntohs (join_resp->size); |
337 | } | 347 | } |
338 | if (dcsn_size < sizeof (*dcsn) + relay_size + join_resp_size) | 348 | if (dcsn_size < sizeof (*dcsn) + relay_size + join_resp_size) |
339 | { | 349 | { |
340 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 350 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
341 | "Received invalid join decision message from multicast.\n"); | 351 | "Received invalid join decision message from multicast: %u < %u + %u + %u\n", |
352 | dcsn_size , sizeof (*dcsn), relay_size, join_resp_size); | ||
342 | GNUNET_break_op (0); | 353 | GNUNET_break_op (0); |
343 | is_admitted = GNUNET_SYSERR; | 354 | is_admitted = GNUNET_SYSERR; |
344 | } | 355 | } |