From: Remi Gacogne Date: Mon, 13 Jun 2016 16:44:40 +0000 (+0200) Subject: Fix usage of std::distance() in DNSName::isPartOf() X-Git-Tag: auth-4.0.0-rc1~14^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d8ec8f441d08511b76ece3215c73b952bc1f56db;p=thirdparty%2Fpdns.git Fix usage of std::distance() in DNSName::isPartOf() --- diff --git a/pdns/dnsname.cc b/pdns/dnsname.cc index 1c81ea10f2..82bc2fe90e 100644 --- a/pdns/dnsname.cc +++ b/pdns/dnsname.cc @@ -200,8 +200,12 @@ bool DNSName::isPartOf(const DNSName& parent) const return false; // this is slightly complicated since we can't start from the end, since we can't see where a label begins/ends then - for(auto us=d_storage.cbegin(); us= static_cast(parent.d_storage.size()); us+=*us+1) { - if (std::distance(us,d_storage.cend()) == static_cast(parent.d_storage.size())) { + for(auto us=d_storage.cbegin(); us(distance) < parent.d_storage.size()) { + break; + } + if (static_cast(distance) == parent.d_storage.size()) { auto p = parent.d_storage.cbegin(); for(; us != d_storage.cend(); ++us, ++p) { if(dns2_tolower(*p) != dns2_tolower(*us))