Skip to content

Commit

Permalink
CLOUD: Fix crash on HTTP request with unparsed path
Browse files Browse the repository at this point in the history
Occurred during an nmap scan. Fixes bug #12997
  • Loading branch information
sluicebox committed Oct 14, 2021
1 parent 562c0f7 commit f3b0451
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backends/networking/sdl_net/handlers/resourcehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ const char *ResourceHandler::determineMimeType(Common::String &filename) {

void ResourceHandler::handle(Client &client) {
Common::String filename = client.path();
filename.deleteChar(0);

// remove leading slash
if (filename.size() > 0 && filename[0] == '/')
filename.deleteChar(0);

// if archive hidden file is requested, ignore
if (filename.size() && filename[0] == '.')
if (filename.size() > 0 && filename[0] == '.')
return;

// if file not found, don't set handler either
Expand Down

0 comments on commit f3b0451

Please sign in to comment.