Skip to content

Commit

Permalink
Prevent out of bounds read (#119)
Browse files Browse the repository at this point in the history
Pages which end with ? would of resulted in an out of bounds read
an example would be 127.0.0.1:8080/index.html?
  • Loading branch information
StarryWisdom authored Jun 9, 2021
1 parent 8c78792 commit 9201e23
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/httpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ void HttpServerConnection::parseUri(const string & sSrc)
std::vector<string> parts = uri.split("?", 1);
request.path = parts[0];

std::vector<string> parameters = parts[1].split("&");
std::vector<string> parameters;
if (parts.size()>1)
{
parameters = parts[1].split("&");
}
for (unsigned int n=0; n<parameters.size(); n++)
{
string param = parameters[n];
Expand Down

0 comments on commit 9201e23

Please sign in to comment.