]> granicus.if.org Git - pdns/commitdiff
Fix matches overflow in dnsdist API.
authorErik Winkels <erik.winkels@powerdns.com>
Tue, 4 Apr 2017 14:40:32 +0000 (16:40 +0200)
committerErik Winkels <erik.winkels@powerdns.com>
Tue, 11 Apr 2017 12:12:52 +0000 (14:12 +0200)
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.

pdns/dnsdist-web.cc

index ccecf1a48aa2043525026c1c18ad2463b00c27af..e913b88ba2aeffbe275467483dd4908b4f825bda 100644 (file)
@@ -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()},
         };