From c984a69fd1331a4ccc74c845ab22146b635640ae Mon Sep 17 00:00:00 2001 From: noctuum <25441068+noctuum@users.noreply.github.com> Date: Sun, 13 Sep 2026 07:33:01 +0500 Subject: [PATCH] Fix cidr /32 ip filter entries covering everything above the address. Shifting end_mask by the full type width is undefined behavior. --- src/command_ip.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/command_ip.cc b/src/command_ip.cc index c4194eaf..185ff37d 100644 --- a/src/command_ip.cc +++ b/src/command_ip.cc @@ -206,6 +206,9 @@ ipv4_range_parse(const char* address, uint32_t* address_start, uint32_t* address if (mask_bits == 0) { mask = 0; end_mask = ~(uint32_t)0; + } else if (mask_bits == 32) { + mask = ~(uint32_t)0; + end_mask = 0; } else { mask = (~mask) << (32-mask_bits); end_mask = (~end_mask) >> mask_bits;