CLOUD: Fix crash on HTTP request with unparsed path

Occurred during an nmap scan. Fixes bug #12997
This commit is contained in:
sluicebox 2021-10-13 19:12:01 -05:00
parent 85f1c96fb5
commit 7468a2e17f

View file

@ -54,10 +54,13 @@ const char *ResourceHandler::determineMimeType(Common::String &filename) {
void ResourceHandler::handle(Client &client) { void ResourceHandler::handle(Client &client) {
Common::String filename = client.path(); Common::String filename = client.path();
// remove leading slash
if (filename.size() > 0 && filename[0] == '/')
filename.deleteChar(0); filename.deleteChar(0);
// if archive hidden file is requested, ignore // if archive hidden file is requested, ignore
if (filename.size() && filename[0] == '.') if (filename.size() > 0 && filename[0] == '.')
return; return;
// if file not found, don't set handler either // if file not found, don't set handler either