From 46d03ec1bde4eb3241f510f300e2a302dcfe65d0 Mon Sep 17 00:00:00 2001 From: Charles-Henri Bruyand Date: Wed, 2 May 2018 16:18:50 +0200 Subject: [PATCH] check if parameter has been submitted before accessing it --- pdns/ws-recursor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdns/ws-recursor.cc b/pdns/ws-recursor.cc index a9991dfef..d3e357e76 100644 --- a/pdns/ws-recursor.cc +++ b/pdns/ws-recursor.cc @@ -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(boost::bind(pleaseWipeCache, canon, subtree)); count += broadcastAccFunction(boost::bind(pleaseWipePacketCache, canon, subtree)); -- 2.40.0