diff options
author | Hernani Marques <hernani@ccc-ch.ch> | 2018-06-24 23:32:01 +0200 |
---|---|---|
committer | Hernani Marques <hernani@ccc-ch.ch> | 2018-06-24 23:33:53 +0200 |
commit | 99f858c66be3206f5660c9d031cd6e6345a1267d (patch) | |
tree | 11d67e2cc8df01230074b89396be7c26b0119b36 | |
parent | 1c47189bb16bffe75dec2c3c666e39790841aa84 (diff) | |
download | gnunet-99f858c66be3206f5660c9d031cd6e6345a1267d.tar.gz gnunet-99f858c66be3206f5660c9d031cd6e6345a1267d.zip |
Avoid dvision by zero
-rw-r--r-- | src/multicast/gnunet-service-multicast.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c index cf7dde913..b5be257d6 100644 --- a/src/multicast/gnunet-service-multicast.c +++ b/src/multicast/gnunet-service-multicast.c | |||
@@ -1448,6 +1448,12 @@ check_client_member_join (void *cls, | |||
1448 | uint16_t msg_size = ntohs (msg->header.size); | 1448 | uint16_t msg_size = ntohs (msg->header.size); |
1449 | struct GNUNET_PeerIdentity *relays = (struct GNUNET_PeerIdentity *) &msg[1]; | 1449 | struct GNUNET_PeerIdentity *relays = (struct GNUNET_PeerIdentity *) &msg[1]; |
1450 | uint32_t relay_count = ntohl (msg->relay_count); | 1450 | uint32_t relay_count = ntohl (msg->relay_count); |
1451 | |||
1452 | if (0 == relay_count} | ||
1453 | { | ||
1454 | GNUNET_break (0); | ||
1455 | return GNUNET_SYSERR; | ||
1456 | } | ||
1451 | if (UINT32_MAX / relay_count < sizeof (*relays)){ | 1457 | if (UINT32_MAX / relay_count < sizeof (*relays)){ |
1452 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1458 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1453 | "relay_count (%lu) * sizeof (*relays) (%lu) exceeds UINT32_MAX!\n", | 1459 | "relay_count (%lu) * sizeof (*relays) (%lu) exceeds UINT32_MAX!\n", |