addrman: cap the max_pct to not exceed the maximum number of addresses

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
This commit is contained in:
brunoerg
2024-11-07 08:34:16 -03:00
parent 2c90f8e08c
commit 9c5775c331
5 changed files with 7 additions and 5 deletions

View File

@@ -173,7 +173,7 @@ FUZZ_TARGET(addrman, .init = initialize_addrman)
network = fuzzed_data_provider.PickValueInArray(ALL_NETWORKS);
}
auto max_addresses = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096);
auto max_pct = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096);
auto max_pct = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 100);
auto filtered = fuzzed_data_provider.ConsumeBool();
(void)const_addr_man.GetAddr(max_addresses, max_pct, network, filtered);