]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
LUA view: do not crash on empty IP list, fixes #8572 8575/head
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 25 Nov 2019 12:05:22 +0000 (13:05 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 25 Nov 2019 17:28:05 +0000 (18:28 +0100)
pdns/lua-record.cc

index 11245186ee7e426431ecff43f7cf25860a118b0a..f3f6bc1776042b232127bf3b0e2bf2efd3fb8e2f 100644 (file)
@@ -827,6 +827,9 @@ void setupLuaRecords()
         for(const auto& nmpair : netmasks) {
           Netmask nm(nmpair.second);
           if(nm.match(s_lua_record_ctx->bestwho)) {
+            if (destinations.empty()) {
+              throw std::invalid_argument("The IP list cannot be empty (for netmask " + nm.toString() + ")");
+            }
             return destinations[dns_random(destinations.size())].second;
           }
         }