mirror of
https://github.com/monero-project/monero.git
synced 2025-08-06 04:44:20 -04:00
p2p: fix integer overflow in host bans
This commit is contained in:
parent
9c77dbf376
commit
5858598604
2 changed files with 25 additions and 13 deletions
|
@ -176,8 +176,15 @@ namespace nodetool
|
|||
if(!addr.is_blockable())
|
||||
return false;
|
||||
|
||||
const time_t now = time(nullptr);
|
||||
|
||||
CRITICAL_REGION_LOCAL(m_blocked_hosts_lock);
|
||||
m_blocked_hosts[addr.host_str()] = time(nullptr) + seconds;
|
||||
time_t limit;
|
||||
if (now > std::numeric_limits<time_t>::max() - seconds)
|
||||
limit = std::numeric_limits<time_t>::max();
|
||||
else
|
||||
limit = now + seconds;
|
||||
m_blocked_hosts[addr.host_str()] = limit;
|
||||
|
||||
// drop any connection to that address. This should only have to look into
|
||||
// the zone related to the connection, but really make sure everything is
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue