aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_peerlist_boost_serialization.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-06-08 15:58:09 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-06-08 17:52:53 +0000
commit2cbe75661cb957f7be409a9e22df97d96329c5c8 (patch)
treeb4eb6c01411100f7f7f2baee61956aedc6453d30 /src/p2p/net_peerlist_boost_serialization.h
parentMerge pull request #5583 (diff)
downloadmonero-2cbe75661cb957f7be409a9e22df97d96329c5c8.tar.xz
p2p: fix GCC 9.1 crash
Diffstat (limited to 'src/p2p/net_peerlist_boost_serialization.h')
-rw-r--r--src/p2p/net_peerlist_boost_serialization.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/p2p/net_peerlist_boost_serialization.h b/src/p2p/net_peerlist_boost_serialization.h
index 40ef2ebcd..32f30adca 100644
--- a/src/p2p/net_peerlist_boost_serialization.h
+++ b/src/p2p/net_peerlist_boost_serialization.h
@@ -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;
@@ -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;