]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Avoid out of bounds access on empty path and do not send a body on 404 9840/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 11 Dec 2020 13:46:49 +0000 (14:46 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 11 Dec 2020 13:46:49 +0000 (14:46 +0100)
pdns/ws-recursor.cc

index 8eac8adab190dca20b77cc1633fdb583e0991506..c6f521d8fbef6e5320e478974e59321157cfb849 100644 (file)
@@ -499,11 +499,10 @@ static void serveStuff(HttpRequest* req, HttpResponse* resp)
   resp->headers["X-XSS-Protection"] = "1; mode=block";
   //  resp->headers["Content-Security-Policy"] = "default-src 'self'; style-src 'self' 'unsafe-inline'";
 
-  if (g_urlmap.count(req->url.path.c_str()+1)) {
+  if (!req->url.path.empty() && g_urlmap.count(req->url.path.c_str()+1)) {
     resp->body = g_urlmap.at(req->url.path.c_str()+1);
     resp->status = 200;
   } else {
-    resp->body = "Not Found";
     resp->status = 404;
   }
 }