-fix #3152
authorChristian Grothoff <christian@grothoff.org>
Sat, 7 Dec 2013 22:27:13 +0000 (22:27 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 7 Dec 2013 22:27:13 +0000 (22:27 +0000)
src/dv/gnunet-service-dv.c

index c7d6a6f40fce22eb19a3922dd1535bf708ff13cb..e15d30eadbdba84eaa8f4a106b39592c530632bd 100644 (file)
@@ -705,6 +705,7 @@ get_consensus_slot (uint32_t distance)
   struct ConsensusSet *cs;
   unsigned int i;
 
+  GNUNET_assert (distance < DEFAULT_FISHEYE_DEPTH - 1);
   cs = &consensi[distance];
   i = 0;
   while ( (i < cs->array_length) &&
@@ -731,6 +732,7 @@ allocate_route (struct Route *route,
 {
   unsigned int i;
 
+  GNUNET_assert (distance < DEFAULT_FISHEYE_DEPTH - 1);
   i = get_consensus_slot (distance);
   route->set_offset = i;
   consensi[distance].targets[i] = route;
@@ -1033,6 +1035,8 @@ check_possible_route (void *cls,
     }
     return GNUNET_YES; /* got a route to this target already */
   }
+  if (ntohl (target->distance) >= DEFAULT_FISHEYE_DEPTH - 1)
+    return GNUNET_YES; /* distance is too large to be interesting */
   route = GNUNET_new (struct Route);
   route->next_hop = neighbor;
   route->target.distance = htonl (ntohl (target->distance) + 1);