From: Erik Winkels Date: Tue, 4 Apr 2017 14:40:32 +0000 (+0200) Subject: Fix matches overflow in dnsdist API. X-Git-Tag: rec-4.1.0-alpha1~163^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dada9ff155e41dc789978b8879003518fbefb5b4;p=thirdparty%2Fpdns.git Fix matches overflow in dnsdist API. The way it is currently fixed means that matches can still overflow in the web interface because JavaScript has a 2^53 number limit. However, this fix is in line with how earlier cases have been fixed. --- diff --git a/pdns/dnsdist-web.cc b/pdns/dnsdist-web.cc index ccecf1a48a..e913b88ba2 100644 --- a/pdns/dnsdist-web.cc +++ b/pdns/dnsdist-web.cc @@ -380,7 +380,7 @@ static void connectionThread(int sock, ComboAddress remote, string password, str for(const auto& a : localRules) { Json::object rule{ {"id", num++}, - {"matches", (int)a.first->d_matches}, + {"matches", (double)a.first->d_matches}, {"rule", a.first->toString()}, {"action", a.second->toString()}, {"action-stats", a.second->getStats()} @@ -394,7 +394,7 @@ static void connectionThread(int sock, ComboAddress remote, string password, str for(const auto& a : localResponseRules) { Json::object rule{ {"id", num++}, - {"matches", (int)a.first->d_matches}, + {"matches", (double)a.first->d_matches}, {"rule", a.first->toString()}, {"action", a.second->toString()}, };