From a211ccb5b6a0281e5aec5a82c08454c2f48eb73c Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 20 Nov 2017 11:01:48 +0100 Subject: [PATCH] rec: Fix the use of a deleted iterator in SyncRes::getDSRecords() --- pdns/syncres.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 4946495c0..5c026511a 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; } } -- 2.40.0