]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Handle exceptions when reading domains from file ignorelist
authorEnsar Sarajčić <dev@ensarsarajcic.com>
Thu, 6 Jun 2024 08:51:26 +0000 (10:51 +0200)
committerEnsar Sarajčić <dev@ensarsarajcic.com>
Thu, 6 Jun 2024 08:51:26 +0000 (10:51 +0200)
pdns/recursordist/rec-main.cc

index 18ada2b75e752e44b9d3be3d5a5a6e4ef68c4dd5..8f92fabb737b99b17864a1957995aa31cf988503 100644 (file)
@@ -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")));
+    }
   }
 }