Skip to content

Commit

Permalink
p2p: fix GCC 9.1 crash
Browse files Browse the repository at this point in the history
  • Loading branch information
moneromooo-monero committed Jun 8, 2019
1 parent 51766d0 commit 2cbe756
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/p2p/net_peerlist_boost_serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ namespace boost
a & port;
a & length;

if (length > net::tor_address::buffer_size())
const size_t buffer_size = net::tor_address::buffer_size();
if (length > buffer_size)
MONERO_THROW(net::error::invalid_tor_address, "Tor address too long");

char host[net::tor_address::buffer_size()] = {0};
char host[buffer_size] = {0};
a.load_binary(host, length);
host[sizeof(host) - 1] = 0;

Expand All @@ -155,10 +156,11 @@ namespace boost
a & port;
a & length;

if (length > net::i2p_address::buffer_size())
const size_t buffer_size = net::i2p_address::buffer_size();
if (length > buffer_size)
MONERO_THROW(net::error::invalid_i2p_address, "i2p address too long");

char host[net::i2p_address::buffer_size()] = {0};
char host[buffer_size] = {0};
a.load_binary(host, length);
host[sizeof(host) - 1] = 0;

Expand Down

0 comments on commit 2cbe756

Please sign in to comment.