]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Do not test node for null, the loop guarantees node is not null. 9078/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 1 May 2020 08:52:50 +0000 (10:52 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 1 May 2020 08:52:50 +0000 (10:52 +0200)
Found by Coverity (1419400), which concludes that if node could be
null, the following node->node.first.getBits() would deref a nullptr.

pdns/iputils.hh

index 2fb2805055597cbbd5686c4fbf70d4568a65c835..968864100abab752fb406af488c02206d5838b51 100644 (file)
@@ -989,7 +989,7 @@ public:
 
     // we turn left on 0 and right on 1
     int bits = 0;
-    for(; node && bits < key.getBits(); bits++) {
+    for(; bits < key.getBits(); bits++) {
       bool vall = key.getBit(-1-bits);
 
       if (bits >= node->d_bits) {