0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-31 22:21:54 +00:00
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).
This commit is contained in:
Igor Putovny 2023-12-13 11:16:12 +01:00
parent 22060fe09f
commit 79981d2ad2

View 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)