From: Peter van Dijk Date: Mon, 25 Nov 2019 12:05:22 +0000 (+0100) Subject: LUA view: do not crash on empty IP list, fixes #8572 X-Git-Tag: auth-4.3.0-alpha1~20^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F8575%2Fhead;p=thirdparty%2Fpdns.git LUA view: do not crash on empty IP list, fixes #8572 --- diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index 11245186ee..f3f6bc1776 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -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; } }