From 28beeb0f76f2ba0dcea0def88fe46dbce51d06eb Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Mon, 25 Nov 2019 13:05:22 +0100 Subject: [PATCH] LUA view: do not crash on empty IP list, fixes #8572 --- pdns/lua-record.cc | 3 +++ 1 file changed, 3 insertions(+) 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; } } -- 2.47.2