mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-18 23:26:17 +00:00
Fix cidr /32 ip filter entries covering everything above the address.
Shifting end_mask by the full type width is undefined behavior.
This commit is contained in:
@@ -206,6 +206,9 @@ ipv4_range_parse(const char* address, uint32_t* address_start, uint32_t* address
|
|||||||
if (mask_bits == 0) {
|
if (mask_bits == 0) {
|
||||||
mask = 0;
|
mask = 0;
|
||||||
end_mask = ~(uint32_t)0;
|
end_mask = ~(uint32_t)0;
|
||||||
|
} else if (mask_bits == 32) {
|
||||||
|
mask = ~(uint32_t)0;
|
||||||
|
end_mask = 0;
|
||||||
} else {
|
} else {
|
||||||
mask = (~mask) << (32-mask_bits);
|
mask = (~mask) << (32-mask_bits);
|
||||||
end_mask = (~end_mask) >> mask_bits;
|
end_mask = (~end_mask) >> mask_bits;
|
||||||
|
|||||||
Reference in New Issue
Block a user