]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Bugfix
authorIgor Putovny <igor.putovny@nic.cz>
Wed, 13 Dec 2023 10:16:12 +0000 (11:16 +0100)
committerIgor Putovny <igor.putovny@nic.cz>
Thu, 30 May 2024 10:30:00 +0000 (12:30 +0200)
Due to wrong cast of void pointer, pointers to potential buckets
were compared and eventually sorted in wrong order, thus assigning
wrong buckets to trie nodes.
This caused some trie nodes to stay in trie even though they should
have been removed. Consequently, trie contained superfluos prefixes
after the algorithm finished.

Since pointers were never dereferenced, only compared by their numeric
values in the comparator function, program did not crash (even though
pointers could be NULL because of the incorrect cast to double pointer
and single dereference).

proto/aggregator/aggregator.c

index 40585e0e1d0af1ba0c24bdd374e88e3d3fb5461e..ea98a3773f951d783c59ba9760045babf640cc1d 100644 (file)
@@ -234,8 +234,8 @@ aggregator_bucket_compare(const void *a, const void *b)
   if (b == NULL)
     return 1;
 
-  const struct aggregator_bucket *fst = *(struct aggregator_bucket **)a;
-  const struct aggregator_bucket *snd = *(struct aggregator_bucket **)b;
+  const struct aggregator_bucket *fst = (struct aggregator_bucket *)a;
+  const struct aggregator_bucket *snd = (struct aggregator_bucket *)b;
 
   /* There is linear ordering on pointers */
   if (fst < snd)