From 5481c77c8917ef3097d37e0da8a450a01b09f3de Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Fri, 6 Jul 2018 18:47:00 +0200 Subject: [PATCH] avoid concurrent records/comments iteration from running out of sync --- pdns/ws-auth.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 5e93f4126a..c589773400 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -407,7 +407,8 @@ static void fillZone(const DNSName& zonename, HttpResponse* resp, bool doRRSets) auto cit = comments.begin(); while (rit != records.end() || cit != comments.end()) { - if (cit == comments.end() || (rit != records.end() && (cit->qname.toString() <= rit->qname.toString() || cit->qtype < rit->qtype || cit->qtype == rit->qtype))) { + // if you think this should be rit < cit instead of cit < rit, note the b < a instead of a < b in the sort comparison functions above + if (cit == comments.end() || (rit != records.end() && (rit->qname == cit->qname ? (cit->qtype < rit->qtype || cit->qtype == rit->qtype) : cit->qname < rit->qname))) { current_qname = rit->qname; current_qtype = rit->qtype; ttl = rit->ttl; -- 2.47.2