forked from tastytea/libravatarserv
Catch non-numeric size and ignore it
This commit is contained in:
parent
69579902e2
commit
df50807eeb
|
@ -47,15 +47,21 @@ const Request http::parse_request(const string &request)
|
||||||
{
|
{
|
||||||
answer = get_parameter(request, "s");
|
answer = get_parameter(request, "s");
|
||||||
if (!answer.empty())
|
if (!answer.empty())
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
size = static_cast<uint16_t>(std::stoul(answer));
|
size = static_cast<uint16_t>(std::stoul(answer));
|
||||||
|
} catch (const std::exception &) {}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
answer = get_parameter(request, "size");
|
answer = get_parameter(request, "size");
|
||||||
if (!answer.empty())
|
if (!answer.empty())
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
size = static_cast<uint16_t>(std::stoul(answer));
|
size = static_cast<uint16_t>(std::stoul(answer));
|
||||||
|
} catch (const std::exception &) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (size > 512)
|
if (size > 512)
|
||||||
|
|
Loading…
Reference in New Issue