Node.js based forum software built for the modern web
closes #4192
barisusakli3d4e058b6a76
diff --git a/src/routes/index.js b/src/routes/index.jsindex 96ff880db0..7e84f29af1 100644--- a/src/routes/index.js+++ b/src/routes/index.js@@ -173,11 +173,11 @@ function handle404(app, middleware) {res.status(404);if (res.locals.isAPI) {- return res.json({path: req.path.replace(/^\/api/, ''), title: '[[global:404.title]]'});+ return res.json({path: validator.escape(req.path.replace(/^\/api/, '') || ''), title: '[[global:404.title]]'});}middleware.buildHeader(req, res, function() {- res.render('404', {path: req.path, title: '[[global:404.title]]'});+ res.render('404', {path: validator.escape(req.path || ''), title: '[[global:404.title]]'});});} else {res.status(404).type('txt').send('Not found');@@ -201,10 +201,10 @@ function handleErrors(app, middleware) {res.status(err.status || 500);if (res.locals.isAPI) {- res.json({path: req.path, error: err.message});+ res.json({path: validator.escape(req.path || ''), error: err.message});} else {middleware.buildHeader(req, res, function() {- res.render('500', {path: req.path, error: validator.escape(err.message)});+ res.render('500', {path: validator.escape(req.path || ''), error: validator.escape(err.message)});});}});