]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Fix the use of a deleted iterator in SyncRes::getDSRecords() 5971/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Nov 2017 10:01:48 +0000 (11:01 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Nov 2017 10:01:48 +0000 (11:01 +0100)
pdns/syncres.cc

index 4946495c028d80cc765747ee9202222b61716e63..5c026511af11c4ccd4803631f0e3a3c2bcac4c12 100644 (file)
@@ -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;
         }
       }