]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Prevent erasing invalid value from options map
authorEnsar Sarajčić <dev@ensarsarajcic.com>
Wed, 5 Feb 2025 17:30:30 +0000 (18:30 +0100)
committerEnsar Sarajčić <dev@ensarsarajcic.com>
Wed, 5 Feb 2025 17:30:30 +0000 (18:30 +0100)
pdns/dnsdistdist/dnsdist-lua-bindings-protobuf.cc

index 31fa8d1a0ae7c3cbb3f414c9edc4b2b7adef2237..49f99ec366bbaa8e18f3a619fb895e15e35bb3a7 100644 (file)
@@ -149,7 +149,9 @@ void setupLuaBindingsProtoBuf(LuaContext& luaCtx, bool client, bool configCheck)
     checkAllParametersConsumed("newFrameStreamUnixLogger", params);
     auto connectionCount = options.find("connectionCount");
     auto count = connectionCount == options.end() ? 1 : connectionCount->second;
-    options.erase(connectionCount);
+    if (connectionCount != options.end()) {
+      options.erase(connectionCount);
+    }
     if (count > 1) {
       std::vector<std::shared_ptr<RemoteLoggerInterface>> loggers;
       loggers.reserve(count);
@@ -176,7 +178,9 @@ void setupLuaBindingsProtoBuf(LuaContext& luaCtx, bool client, bool configCheck)
     checkAllParametersConsumed("newFrameStreamTcpLogger", params);
     auto connectionCount = options.find("connectionCount");
     auto count = connectionCount == options.end() ? 1 : connectionCount->second;
-    options.erase(connectionCount);
+    if (connectionCount != options.end()) {
+      options.erase(connectionCount);
+    }
     if (count > 1) {
       std::vector<std::shared_ptr<RemoteLoggerInterface>> loggers;
       loggers.reserve(count);