From d8ec8f441d08511b76ece3215c73b952bc1f56db Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 13 Jun 2016 18:44:40 +0200 Subject: [PATCH] Fix usage of std::distance() in DNSName::isPartOf() --- pdns/dnsname.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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)) -- 2.47.2