mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 20:47:10 +11:00
requests that accept 2^32 reject arguments larger than 2^32
This commit is contained in:
parent
a8b7defb36
commit
1b2c763f0b
1 changed files with 4 additions and 4 deletions
|
|
@ -52,7 +52,7 @@ void api::SendFunds(req_args)
|
||||||
{
|
{
|
||||||
std::string_view name;
|
std::string_view name;
|
||||||
uint64_t amount; // as simdjson lacks .get(uint32_t support)
|
uint64_t amount; // as simdjson lacks .get(uint32_t support)
|
||||||
if (doc["name"].get(name) || doc["amount"].get(amount))
|
if (doc["name"].get(name) || doc["amount"].get(amount) || (amount > std::numeric_limits<uint32_t>::max()))
|
||||||
{
|
{
|
||||||
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +135,7 @@ void api::SetBal(req_args)
|
||||||
{
|
{
|
||||||
std::string_view name;
|
std::string_view name;
|
||||||
uint64_t amount;
|
uint64_t amount;
|
||||||
if (doc["name"].get(name) || doc["amount"].get(amount))
|
if (doc["name"].get(name) || doc["amount"].get(amount) || (amount > std::numeric_limits<uint32_t>::max()))
|
||||||
{
|
{
|
||||||
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
|
|
@ -231,7 +231,7 @@ void api::PruneUsers(req_args)
|
||||||
#if MAX_LOG_SIZE > 0
|
#if MAX_LOG_SIZE > 0
|
||||||
int64_t time;
|
int64_t time;
|
||||||
uint64_t amount;
|
uint64_t amount;
|
||||||
if (doc["time"].get(time) || doc["amount"].get(amount))
|
if (doc["time"].get(time) || doc["amount"].get(amount) || (amount > std::numeric_limits<uint32_t>::max()))
|
||||||
{
|
{
|
||||||
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
|
|
@ -241,7 +241,7 @@ void api::PruneUsers(req_args)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
uint64_t amount
|
uint64_t amount
|
||||||
if (doc["amount"].get(amount))
|
if (doc["amount"].get(amount) || (amount > std::numeric_limits<uint32_t>::max()))
|
||||||
{
|
{
|
||||||
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
res = BankResponse{k400BadRequest, "\"Missing/Invalid JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue