From: Remi Gacogne Date: Mon, 5 Mar 2018 09:43:44 +0000 (+0100) Subject: dnsdist: Check that the number of sockets is > 0 X-Git-Tag: dnsdist-1.3.0~35^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e998def2a9007aab462c90ff5badc2eab7253ee8;p=thirdparty%2Fpdns.git dnsdist: Check that the number of sockets is > 0 --- diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index a73b6d1b10..55ee582a1b 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -217,9 +217,13 @@ void setupLuaConfig(bool client) } } - if(vars.count("sockets")) { - numberOfSockets=std::stoi(boost::get(vars["sockets"])); - } + if (vars.count("sockets")) { + numberOfSockets = std::stoul(boost::get(vars["sockets"])); + if (numberOfSockets == 0) { + warnlog("Dismissing invalid number of sockets '%s', using 1 instead", boost::get(vars["sockets"])); + numberOfSockets = 1; + } + } std::shared_ptr ret; try {