From: Miod Vallat Date: Fri, 10 Oct 2025 12:12:04 +0000 (+0200) Subject: In getUpdatedPrimaries(), parse zone name first. X-Git-Tag: rec-5.4.0-alpha1~210^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9645664d894b3ea9eb01c66256cec7607a6901cf;p=thirdparty%2Fpdns.git In getUpdatedPrimaries(), parse zone name first. Otherwise, if another field is not parsed correctly, we risk triggering another exception while attempting to use the unset zone name in the error report. Signed-off-by: Miod Vallat --- diff --git a/pdns/backends/gsql/gsqlbackend.cc b/pdns/backends/gsql/gsqlbackend.cc index 06de81732c..d2e78b1892 100644 --- a/pdns/backends/gsql/gsqlbackend.cc +++ b/pdns/backends/gsql/gsqlbackend.cc @@ -556,14 +556,6 @@ void GSQLBackend::getUpdatedPrimaries(vector& updatedDomains, std::u di.backend = this; - try { - pdns::checked_stoi_into(di.id, row[0]); - } - catch (const std::exception& e) { - g_log << Logger::Warning << __PRETTY_FUNCTION__ << " could not convert id '" << row[0] << "' for zone '" << di.zone << "' into an integer: " << e.what() << endl; - continue; - } - try { di.zone = ZoneName(row[1]); } @@ -576,6 +568,14 @@ void GSQLBackend::getUpdatedPrimaries(vector& updatedDomains, std::u continue; } + try { + pdns::checked_stoi_into(di.id, row[0]); + } + catch (const std::exception& e) { + g_log << Logger::Warning << __PRETTY_FUNCTION__ << " could not convert id '" << row[0] << "' for zone '" << di.zone << "' into an integer: " << e.what() << endl; + continue; + } + try { di.catalog = ZoneName(row[5]); }