]> granicus.if.org Git - pdns/commitdiff
check if parameter has been submitted before accessing it
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Wed, 2 May 2018 14:18:50 +0000 (16:18 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 16 May 2018 09:30:51 +0000 (11:30 +0200)
(cherry picked from commit 46d03ec1bde4eb3241f510f300e2a302dcfe65d0)

pdns/ws-recursor.cc

index 748441c9a25651437461e2bf13b30862229333a3..16a58b864aa0d8f71af6a182745507e081f15aaf 100644 (file)
@@ -373,7 +373,7 @@ static void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp) {
     throw HttpMethodNotAllowedException();
 
   DNSName canon = apiNameToDNSName(req->getvars["domain"]);
-  bool subtree = (req->getvars["subtree"].compare("true") == 0);
+  bool subtree = (req->getvars.count("subtree") > 0 && req->getvars["subtree"].compare("true") == 0);
 
   int count = broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeCache, canon, subtree));
   count += broadcastAccFunction<uint64_t>(boost::bind(pleaseWipePacketCache, canon, subtree));