From: Ensar Sarajčić Date: Thu, 6 Jun 2024 08:51:26 +0000 (+0200) Subject: Handle exceptions when reading domains from file ignorelist X-Git-Tag: rec-5.2.0-alpha0~19^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6e39885229f284d56a133ba1053add9f08f55475;p=thirdparty%2Fpdns.git Handle exceptions when reading domains from file ignorelist --- diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 18ada2b75e..8f92fabb73 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -879,7 +879,13 @@ static void parseIgnorelistFile(const std::string& fname, SuffixMatchNode& match while (getline(ignorelistFileStream, line)) { boost::trim(line); - matchNode.add(DNSName(line)); + try { + matchNode.add(DNSName(line)); + } + catch (const std::exception& e) { + SLOG(g_log << Logger::Warning << "Ignoring line of ignorelist due to an error: " << e.what() << endl, + g_slog->withName("config")->error(Logr::Warning, e.what(), "Ignoring line of ignorelist due to an error", "exception", Logging::Loggable("std::exception"))); + } } }