Skip to content

Commit

Permalink
Fix security issue (DEGoodmanWilson#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahamirwasia committed Oct 3, 2018
1 parent de6f061 commit a26baea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion luna/router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ void router::handle_request(request_method method,
}

void router::serve_files(std::string mount_point, std::string path_to_files)
{
{
std::regex parent_dir_pattern("(../)+");
path_to_files = std::regex_replace(path_to_files, parent_dir_pattern, "");

std::regex route{mount_point + "(.*)"};
std::string local_path{path_to_files + "/"};
handle_request(request_method::GET, route, [=](const request &req) -> response
Expand Down

0 comments on commit a26baea

Please sign in to comment.