aboutsummaryrefslogtreecommitdiff
path: root/src/netaddress.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-11-23 09:49:41 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2018-11-23 09:53:20 +0100
commit2479b779aae435d45062cea902dbb7638e14b88f (patch)
tree3d97273c78dbd2a49206daa37638ff8fb1a2b333 /src/netaddress.cpp
parenta0d86815cda982d06db333fd9290aa82660807cb (diff)
parentb7b36decaf878a8c1dcfdb4a27196c730043474b (diff)
Merge #14728: fix uninitialized read when stringifying an addrLocal
b7b36decaf878a8c1dcfdb4a27196c730043474b fix uninitialized read when stringifying an addrLocal (Kaz Wesley) 8ebbef016928811756e46b9086067d1c826797a8 add test demonstrating addrLocal UB (Kaz Wesley) Pull request description: Reachable from either place where SetIP is used when all of: - our best-guess addrLocal for a peer is IPv4 - the peer tells us it's reaching us at an IPv6 address - NET logging is enabled In that case, SetIP turns an IPv4 address into an IPv6 address without setting the scopeId, which is subsequently read in GetSockAddr during CNetAddr::ToStringIP and passed to getnameinfo. Fix by ensuring every constructor initializes the scopeId field with something. Tree-SHA512: 8f0159750995e08b985335ccf60a273ebd09003990bcf2c3838b550ed8dc2659552ac7611650e6dd8e29d786fe52ed57674f5880f2e18dc594a7a863134739e3
Diffstat (limited to 'src/netaddress.cpp')
-rw-r--r--src/netaddress.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/netaddress.cpp b/src/netaddress.cpp
index 72be77dfd9..a0c7f8e3c2 100644
--- a/src/netaddress.cpp
+++ b/src/netaddress.cpp
@@ -17,7 +17,6 @@ static const unsigned char g_internal_prefix[] = { 0xFD, 0x6B, 0x88, 0xC0, 0x87,
CNetAddr::CNetAddr()
{
memset(ip, 0, sizeof(ip));
- scopeId = 0;
}
void CNetAddr::SetIP(const CNetAddr& ipIn)