]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
iputils.hh: Netmask: Prevent the construction of a 128-bit IPv4 netmask.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Mon, 30 Sep 2019 08:30:24 +0000 (10:30 +0200)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 11 Feb 2020 01:01:47 +0000 (02:01 +0100)
pdns/iputils.hh

index 2c453071f610e4663a2eb0366c38374505b9eb4b..f3537e042ff43294d4ab7eb277bb044b3280b84a 100644 (file)
@@ -423,10 +423,8 @@ public:
   Netmask(const ComboAddress& network, uint8_t bits=0xff): d_network(network)
   {
     d_network.sin4.sin_port=0;
-    if(bits > 128)
-      bits = (network.sin4.sin_family == AF_INET) ? 32 : 128;
+    d_bits = (network.isIPv4() ? std::min(bits, (uint8_t)32) : std::min(bits, (uint8_t)128));
 
-    d_bits = bits;
     if(d_bits<32)
       d_mask=~(0xFFFFFFFF>>d_bits);
     else