luci-base: don't propagate null bytes in path information

It is possible to inject unescaped markup using a double encoded null byte
via PATH_INFO on certain leaf nodes.

Since there is no legitimate reason to handle null bytes in any part of the
requested url, simply skip over such bytes when parsing the PATH_INFO value.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2018-04-10 11:38:29 +02:00
parent ad7dc4a492
commit b194b8882e

View file

@ -113,7 +113,8 @@ function httpdispatch(request, prefix)
end
end
for node in pathinfo:gmatch("[^/]+") do
local node
for node in pathinfo:gmatch("[^/%z]+") do
r[#r+1] = node
end