From: Remi Gacogne Date: Mon, 20 Nov 2017 10:01:48 +0000 (+0100) Subject: rec: Fix the use of a deleted iterator in SyncRes::getDSRecords() X-Git-Tag: auth-4.1.0~30^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F5971%2Fhead;p=thirdparty%2Fpdns.git rec: Fix the use of a deleted iterator in SyncRes::getDSRecords() --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 4946495c02..5c026511af 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -1590,9 +1590,12 @@ vState SyncRes::getDSRecords(const DNSName& zone, dsmap_t& ds, bool taOnly, unsi * digests if DS RRs with SHA-256 digests are present in the DS RRset." * As SHA348 is specified as well, the spirit of the this line is "use the best algorithm". */ - for (const auto& dsrec : ds) { - if (dsrec.d_digesttype != bestDigestType) { - ds.erase(dsrec); + for (auto dsrec = ds.begin(); dsrec != ds.end(); ) { + if (dsrec->d_digesttype != bestDigestType) { + dsrec = ds.erase(dsrec); + } + else { + ++dsrec; } }