aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-25 13:24:36 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-25 13:24:36 +0000
commit250289d4a2b1a4d5dc11b8502241a16bddeb18e0 (patch)
treec1c2977d78a820d38d6ff0a177bc823e983ee469 /src/dht
parent2e0897995fd89619b9da5050372239736bf87d68 (diff)
downloadgnunet-250289d4a2b1a4d5dc11b8502241a16bddeb18e0.tar.gz
gnunet-250289d4a2b1a4d5dc11b8502241a16bddeb18e0.zip
fix loop bounds
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c4
1 files 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,
1065 /* select "random" peer */ 1065 /* select "random" peer */
1066 /* count number of peers that are available and not filtered */ 1066 /* count number of peers that are available and not filtered */
1067 count = 0; 1067 count = 0;
1068 for (bc = closest_bucket; bc < MAX_BUCKETS; bc++) 1068 for (bc = 0; bc < closest_bucket; bc++)
1069 { 1069 {
1070 pos = k_buckets[bc].head; 1070 pos = k_buckets[bc].head;
1071 while ((pos != NULL) && (count < bucket_size)) 1071 while ((pos != NULL) && (count < bucket_size))
@@ -1100,7 +1100,7 @@ select_peer (const GNUNET_HashCode *key,
1100 /* Now actually choose a peer */ 1100 /* Now actually choose a peer */
1101 selected = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, count); 1101 selected = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, count);
1102 count = 0; 1102 count = 0;
1103 for (bc = closest_bucket; bc < MAX_BUCKETS; bc++) 1103 for (bc = 0; bc < closest_bucket; bc++)
1104 { 1104 {
1105 pos = k_buckets[bc].head; 1105 pos = k_buckets[bc].head;
1106 while ((pos != NULL) && (count < bucket_size)) 1106 while ((pos != NULL) && (count < bucket_size))