From: Remi Gacogne Date: Fri, 26 Feb 2016 10:17:29 +0000 (+0100) Subject: dnsdist: Fix crash when calling rmServer() with an invalid index X-Git-Tag: rec-4.0.0-alpha2~51^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f06cd4cdec8b7f7f7edb082afd94547a7a6d08a;p=thirdparty%2Fpdns.git dnsdist: Fix crash when calling rmServer() with an invalid index Fix #3460. --- diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index d114634787..fdde7611be 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -394,12 +394,14 @@ vector> setupLua(bool client, const std::string& confi } else { int idx = boost::get(var); - server = states[idx]; + server = states.at(idx); } auto localPools = g_pools.getCopy(); for (const string& poolName : server->pools) { removeServerFromPool(localPools, poolName, server); } + /* the server might also be in the default pool */ + removeServerFromPool(localPools, "", server); g_pools.setState(localPools); states.erase(remove(states.begin(), states.end(), server), states.end()); g_dstates.setState(states);