Catch non-numeric size and ignore it
This commit is contained in:
parent
69579902e2
commit
df50807eeb
10
src/http.cpp
10
src/http.cpp
@ -48,14 +48,20 @@ const Request http::parse_request(const string &request)
|
||||
answer = get_parameter(request, "s");
|
||||
if (!answer.empty())
|
||||
{
|
||||
size = static_cast<uint16_t>(std::stoul(answer));
|
||||
try
|
||||
{
|
||||
size = static_cast<uint16_t>(std::stoul(answer));
|
||||
} catch (const std::exception &) {}
|
||||
}
|
||||
else
|
||||
{
|
||||
answer = get_parameter(request, "size");
|
||||
if (!answer.empty())
|
||||
{
|
||||
size = static_cast<uint16_t>(std::stoul(answer));
|
||||
try
|
||||
{
|
||||
size = static_cast<uint16_t>(std::stoul(answer));
|
||||
} catch (const std::exception &) {}
|
||||
}
|
||||
}
|
||||
if (size > 512)
|
||||
|
Loading…
x
Reference in New Issue
Block a user