From: Otto Moerbeek Date: Fri, 1 May 2020 08:52:50 +0000 (+0200) Subject: Do not test node for null, the loop guarantees node is not null. X-Git-Tag: dnsdist-1.5.0-rc2~5^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=243134ef3aba940c92ef84ff342acf690cc77db8;p=thirdparty%2Fpdns.git Do not test node for null, the loop guarantees node is not null. Found by Coverity (1419400), which concludes that if node could be null, the following node->node.first.getBits() would deref a nullptr. --- diff --git a/pdns/iputils.hh b/pdns/iputils.hh index 2fb2805055..968864100a 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -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) {