From 250289d4a2b1a4d5dc11b8502241a16bddeb18e0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 25 Oct 2011 13:24:36 +0000 Subject: [PATCH] fix loop bounds --- src/dht/gnunet-service-dht_neighbours.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 637c9ecc7..9362d28c5 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c @@ -1065,7 +1065,7 @@ select_peer (const GNUNET_HashCode *key, /* select "random" peer */ /* count number of peers that are available and not filtered */ count = 0; - for (bc = closest_bucket; bc < MAX_BUCKETS; bc++) + for (bc = 0; bc < closest_bucket; bc++) { pos = k_buckets[bc].head; while ((pos != NULL) && (count < bucket_size)) @@ -1100,7 +1100,7 @@ select_peer (const GNUNET_HashCode *key, /* Now actually choose a peer */ selected = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, count); count = 0; - for (bc = closest_bucket; bc < MAX_BUCKETS; bc++) + for (bc = 0; bc < closest_bucket; bc++) { pos = k_buckets[bc].head; while ((pos != NULL) && (count < bucket_size)) -- 2.25.1