connection: Limit buffer size bits to WL_BUFFER_DEFAULT_SIZE_POT

The previous code tried to do this but had an off-by-1 error.

Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
This commit is contained in:
Demi Marie Obenour 2024-08-10 18:05:59 -04:00
parent 507884a123
commit f8ecb6d531

View file

@ -198,7 +198,7 @@ get_max_size_bits_for_size(size_t buffer_size)
uint32_t max_size_bits = WL_BUFFER_DEFAULT_SIZE_POT;
while (max_size_bits < 8 * sizeof(size_t) && size_pot(max_size_bits) < buffer_size)
while (max_size_bits < WL_BUFFER_MAX_SIZE_POT && size_pot(max_size_bits) < buffer_size)
max_size_bits++;
return max_size_bits;