Avoid dvision by zero
authorHernani Marques <hernani@ccc-ch.ch>
Sun, 24 Jun 2018 21:32:01 +0000 (23:32 +0200)
committerHernani Marques <hernani@ccc-ch.ch>
Sun, 24 Jun 2018 21:33:53 +0000 (23:33 +0200)
src/multicast/gnunet-service-multicast.c

index cf7dde9133a3d7f58b001415c4ad0b4aa8603cfa..b5be257d6c15b72a73f533e387f512fcbe1fa3ba 100644 (file)
@@ -1448,6 +1448,12 @@ check_client_member_join (void *cls,
   uint16_t msg_size = ntohs (msg->header.size);
   struct GNUNET_PeerIdentity *relays = (struct GNUNET_PeerIdentity *) &msg[1];
   uint32_t relay_count = ntohl (msg->relay_count);
+
+  if (0 == relay_count}
+  {
+     GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
   if (UINT32_MAX / relay_count < sizeof (*relays)){
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                     "relay_count (%lu) * sizeof (*relays)  (%lu) exceeds UINT32_MAX!\n",